1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
|
# $Id$
#
# Copyright (C) 2014 Dragon Research Labs ("DRL")
# Portions copyright (C) 2009--2013 Internet Systems Consortium ("ISC")
# Portions copyright (C) 2007--2008 American Registry for Internet Numbers ("ARIN")
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notices and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND DRL, ISC, AND ARIN DISCLAIM ALL
# WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL DRL,
# ISC, OR ARIN BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
# CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
# OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
# NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
# WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
"""
Exception definitions for RPKI modules.
"""
class RPKI_Exception(Exception):
"""
Base class for RPKI exceptions.
"""
class NotInDatabase(RPKI_Exception):
"""
Lookup failed for an object expected to be in the database.
"""
class BadURISyntax(RPKI_Exception):
"""
Illegal syntax for a URI.
"""
class BadStatusCode(RPKI_Exception):
"""
Unrecognized protocol status code.
"""
class BadQuery(RPKI_Exception):
"""
Unexpected protocol query.
"""
class DBConsistancyError(RPKI_Exception):
"""
Found multiple matches for a database query that shouldn't ever
return that.
"""
class CMSVerificationFailed(RPKI_Exception):
"""
Verification of a CMS message failed.
"""
class HTTPRequestFailed(RPKI_Exception):
"""
HTTP request failed.
"""
class DERObjectConversionError(RPKI_Exception):
"""
Error trying to convert a DER-based object from one representation
to another.
"""
class NotACertificateChain(RPKI_Exception):
"""
Certificates don't form a proper chain.
"""
class BadContactURL(RPKI_Exception):
"""
Error trying to parse contact URL.
"""
class BadClassNameSyntax(RPKI_Exception):
"""
Illegal syntax for a class_name.
"""
class BadIssueResponse(RPKI_Exception):
"""
issue_response PDU with wrong number of classes or certificates.
"""
class NotImplementedYet(RPKI_Exception):
"""
Internal error -- not implemented yet.
"""
class BadPKCS10(RPKI_Exception):
"""
Bad PKCS #10 object.
"""
class UpstreamError(RPKI_Exception):
"""
Received an error from upstream.
"""
class ChildNotFound(RPKI_Exception):
"""
Could not find specified child in database.
"""
class BSCNotFound(RPKI_Exception):
"""
Could not find specified BSC in database.
"""
class BadSender(RPKI_Exception):
"""
Unexpected XML sender value.
"""
class ClassNameMismatch(RPKI_Exception):
"""
class_name does not match child context.
"""
class ClassNameUnknown(RPKI_Exception):
"""
Unknown class_name.
"""
class SKIMismatch(RPKI_Exception):
"""
SKI value in response does not match request.
"""
class SubprocessError(RPKI_Exception):
"""
Subprocess returned unexpected error.
"""
class BadIRDBReply(RPKI_Exception):
"""
Unexpected reply to IRDB query.
"""
class NotFound(RPKI_Exception):
"""
Object not found in database.
"""
class MustBePrefix(RPKI_Exception):
"""
Resource range cannot be expressed as a prefix.
"""
class TLSValidationError(RPKI_Exception):
"""
TLS certificate validation error.
"""
class MultipleTLSEECert(TLSValidationError):
"""
Received more than one TLS EE certificate.
"""
class ReceivedTLSCACert(TLSValidationError):
"""
Received CA certificate via TLS.
"""
class WrongEContentType(RPKI_Exception):
"""
Received wrong CMS eContentType.
"""
class EmptyPEM(RPKI_Exception):
"""
Couldn't find PEM block to convert.
"""
class UnexpectedCMSCerts(RPKI_Exception):
"""
Received CMS certs when not expecting any.
"""
class UnexpectedCMSCRLs(RPKI_Exception):
"""
Received CMS CRLs when not expecting any.
"""
class MissingCMSEEcert(RPKI_Exception):
"""
Didn't receive CMS EE cert when expecting one.
"""
class MissingCMSCRL(RPKI_Exception):
"""
Didn't receive CMS CRL when expecting one.
"""
class UnparsableCMSDER(RPKI_Exception):
"""
Alleged CMS DER wasn't parsable.
"""
class CMSCRLNotSet(RPKI_Exception):
"""
CMS CRL has not been configured.
"""
class ServerShuttingDown(RPKI_Exception):
"""
Server is shutting down.
"""
class NoActiveCA(RPKI_Exception):
"""
No active ca_detail for specified class.
"""
class BadClientURL(RPKI_Exception):
"""
URL given to HTTP client does not match profile.
"""
class ClientNotFound(RPKI_Exception):
"""
Could not find specified client in database.
"""
class BadExtension(RPKI_Exception):
"""
Forbidden X.509 extension.
"""
class ForbiddenURI(RPKI_Exception):
"""
Forbidden URI, does not start with correct base URI.
"""
class HTTPClientAborted(RPKI_Exception):
"""
HTTP client connection closed while in request-sent state.
"""
class BadPublicationReply(RPKI_Exception):
"""
Unexpected reply to publication query.
"""
class DuplicateObject(RPKI_Exception):
"""
Attempt to create an object that already exists.
"""
class EmptyROAPrefixList(RPKI_Exception):
"""
Can't create ROA with an empty prefix list.
"""
class NoCoveringCertForROA(RPKI_Exception):
"""
Couldn't find a covering certificate to generate ROA.
"""
class BSCNotReady(RPKI_Exception):
"""
BSC not yet in a usable state, signing_cert not set.
"""
class HTTPUnexpectedState(RPKI_Exception):
"""
HTTP event occurred in an unexpected state.
"""
class HTTPBadVersion(RPKI_Exception):
"""
HTTP couldn't parse HTTP version.
"""
class HandleTranslationError(RPKI_Exception):
"""
Internal error translating protocol handle -> SQL id.
"""
class NoObjectAtURI(RPKI_Exception):
"""
No object published at specified URI.
"""
class CMSContentNotSet(RPKI_Exception):
"""
Inner content of a CMS_object has not been set. If object is known
to be valid, the .extract() method should be able to set the
content; otherwise, only the .verify() method (which checks
signatures) is safe.
"""
class HTTPTimeout(RPKI_Exception):
"""
HTTP connection timed out.
"""
class BadIPResource(RPKI_Exception):
"""
Parse failure for alleged IP resource string.
"""
class BadROAPrefix(RPKI_Exception):
"""
Parse failure for alleged ROA prefix string.
"""
class CommandParseFailure(RPKI_Exception):
"""
Failed to parse command line.
"""
class CMSCertHasExpired(RPKI_Exception):
"""
CMS certificate has expired.
"""
class TrustedCMSCertHasExpired(RPKI_Exception):
"""
Trusted CMS certificate has expired.
"""
class MultipleCMSEECert(RPKI_Exception):
"""
Can't have more than one CMS EE certificate in validation chain.
"""
class ResourceOverlap(RPKI_Exception):
"""
Overlapping resources in resource_set.
"""
class CMSReplay(RPKI_Exception):
"""
Possible CMS replay attack detected.
"""
class PastNotAfter(RPKI_Exception):
"""
Requested notAfter value is already in the past.
"""
class NullValidityInterval(RPKI_Exception):
"""
Requested validity interval is null.
"""
class BadX510DN(RPKI_Exception):
"""
X.510 distinguished name does not match profile.
"""
class BadAutonomousSystemNumber(RPKI_Exception):
"""
Bad AutonomousSystem number.
"""
class WrongEKU(RPKI_Exception):
"""
Extended Key Usage extension does not match profile.
"""
|