00001 """ 00002 Exception definitions for RPKI modules. 00003 00004 $Id: exceptions.py 2907 2009-12-23 20:48:19Z sra $ 00005 00006 Copyright (C) 2009 Internet Systems Consortium ("ISC") 00007 00008 Permission to use, copy, modify, and distribute this software for any 00009 purpose with or without fee is hereby granted, provided that the above 00010 copyright notice and this permission notice appear in all copies. 00011 00012 THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH 00013 REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 00014 AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT, 00015 INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 00016 LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 00017 OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 00018 PERFORMANCE OF THIS SOFTWARE. 00019 00020 Portions copyright (C) 2007--2008 American Registry for Internet Numbers ("ARIN") 00021 00022 Permission to use, copy, modify, and distribute this software for any 00023 purpose with or without fee is hereby granted, provided that the above 00024 copyright notice and this permission notice appear in all copies. 00025 00026 THE SOFTWARE IS PROVIDED "AS IS" AND ARIN DISCLAIMS ALL WARRANTIES WITH 00027 REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 00028 AND FITNESS. IN NO EVENT SHALL ARIN BE LIABLE FOR ANY SPECIAL, DIRECT, 00029 INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 00030 LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE 00031 OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 00032 PERFORMANCE OF THIS SOFTWARE. 00033 """ 00034 00035 class RPKI_Exception(Exception): 00036 """ 00037 Base class for RPKI exceptions. 00038 """ 00039 00040 class NotInDatabase(RPKI_Exception): 00041 """ 00042 Lookup failed for an object expected to be in the database. 00043 """ 00044 00045 class BadURISyntax(RPKI_Exception): 00046 """ 00047 Illegal syntax for a URI. 00048 """ 00049 00050 class BadStatusCode(RPKI_Exception): 00051 """ 00052 Unrecognized protocol status code. 00053 """ 00054 00055 class BadQuery(RPKI_Exception): 00056 """ 00057 Unexpected protocol query. 00058 """ 00059 00060 class DBConsistancyError(RPKI_Exception): 00061 """ 00062 Found multiple matches for a database query that shouldn't ever 00063 return that. 00064 """ 00065 00066 class CMSVerificationFailed(RPKI_Exception): 00067 """ 00068 Verification of a CMS message failed. 00069 """ 00070 00071 class HTTPRequestFailed(RPKI_Exception): 00072 """ 00073 HTTP request failed. 00074 """ 00075 00076 class DERObjectConversionError(RPKI_Exception): 00077 """ 00078 Error trying to convert a DER-based object from one representation 00079 to another. 00080 """ 00081 00082 class NotACertificateChain(RPKI_Exception): 00083 """ 00084 Certificates don't form a proper chain. 00085 """ 00086 00087 class BadContactURL(RPKI_Exception): 00088 """ 00089 Error trying to parse contact URL. 00090 """ 00091 00092 class BadClassNameSyntax(RPKI_Exception): 00093 """ 00094 Illegal syntax for a class_name. 00095 """ 00096 00097 class BadIssueResponse(RPKI_Exception): 00098 """ 00099 issue_response PDU with wrong number of classes or certificates. 00100 """ 00101 00102 class NotImplementedYet(RPKI_Exception): 00103 """ 00104 Internal error -- not implemented yet. 00105 """ 00106 00107 class BadPKCS10(RPKI_Exception): 00108 """ 00109 Bad PKCS #10 object. 00110 """ 00111 00112 class UpstreamError(RPKI_Exception): 00113 """ 00114 Received an error from upstream. 00115 """ 00116 00117 class ChildNotFound(RPKI_Exception): 00118 """ 00119 Could not find specified child in database. 00120 """ 00121 00122 class BSCNotFound(RPKI_Exception): 00123 """ 00124 Could not find specified BSC in database. 00125 """ 00126 00127 class BadSender(RPKI_Exception): 00128 """ 00129 Unexpected XML sender value. 00130 """ 00131 00132 class ClassNameMismatch(RPKI_Exception): 00133 """ 00134 class_name does not match child context. 00135 """ 00136 00137 class ClassNameUnknown(RPKI_Exception): 00138 """ 00139 Unknown class_name. 00140 """ 00141 00142 class SKIMismatch(RPKI_Exception): 00143 """ 00144 SKI value in response does not match request. 00145 """ 00146 00147 class SubprocessError(RPKI_Exception): 00148 """ 00149 Subprocess returned unexpected error. 00150 """ 00151 00152 class BadIRDBReply(RPKI_Exception): 00153 """ 00154 Unexpected reply to IRDB query. 00155 """ 00156 00157 class NotFound(RPKI_Exception): 00158 """ 00159 Object not found in database. 00160 """ 00161 00162 class MustBePrefix(RPKI_Exception): 00163 """ 00164 Resource range cannot be expressed as a prefix. 00165 """ 00166 00167 class TLSValidationError(RPKI_Exception): 00168 """ 00169 TLS certificate validation error. 00170 """ 00171 00172 class MultipleTLSEECert(TLSValidationError): 00173 """ 00174 Received more than one TLS EE certificate. 00175 """ 00176 00177 class ReceivedTLSCACert(TLSValidationError): 00178 """ 00179 Received CA certificate via TLS. 00180 """ 00181 00182 class WrongEContentType(RPKI_Exception): 00183 """ 00184 Received wrong CMS eContentType. 00185 """ 00186 00187 class EmptyPEM(RPKI_Exception): 00188 """ 00189 Couldn't find PEM block to convert. 00190 """ 00191 00192 class UnexpectedCMSCerts(RPKI_Exception): 00193 """ 00194 Received CMS certs when not expecting any. 00195 """ 00196 00197 class UnexpectedCMSCRLs(RPKI_Exception): 00198 """ 00199 Received CMS CRLs when not expecting any. 00200 """ 00201 00202 class MissingCMSEEcert(RPKI_Exception): 00203 """ 00204 Didn't receive CMS EE cert when expecting one. 00205 """ 00206 00207 class MissingCMSCRL(RPKI_Exception): 00208 """ 00209 Didn't receive CMS CRL when expecting one. 00210 """ 00211 00212 class UnparsableCMSDER(RPKI_Exception): 00213 """ 00214 Alleged CMS DER wasn't parsable. 00215 """ 00216 00217 class CMSCRLNotSet(RPKI_Exception): 00218 """ 00219 CMS CRL has not been configured. 00220 """ 00221 00222 class ServerShuttingDown(RPKI_Exception): 00223 """ 00224 Server is shutting down. 00225 """ 00226 00227 class NoActiveCA(RPKI_Exception): 00228 """ 00229 No active ca_detail for specified class. 00230 """ 00231 00232 class BadClientURL(RPKI_Exception): 00233 """ 00234 URL given to HTTPS client does not match profile. 00235 """ 00236 00237 class ClientNotFound(RPKI_Exception): 00238 """ 00239 Could not find specified client in database. 00240 """ 00241 00242 class BadExtension(RPKI_Exception): 00243 """ 00244 Forbidden X.509 extension. 00245 """ 00246 00247 class ForbiddenURI(RPKI_Exception): 00248 """ 00249 Forbidden URI, does not start with correct base URI. 00250 """ 00251 00252 class HTTPSClientAborted(RPKI_Exception): 00253 """ 00254 HTTPS client connection closed while in request-sent state. 00255 """ 00256 00257 class BadPublicationReply(RPKI_Exception): 00258 """ 00259 Unexpected reply to publication query. 00260 """ 00261 00262 class DuplicateObject(RPKI_Exception): 00263 """ 00264 Attempt to create an object that already exists. 00265 """ 00266 00267 class EmptyROAPrefixList(RPKI_Exception): 00268 """ 00269 Can't create ROA with an empty prefix list. 00270 """ 00271 00272 class NoCoveringCertForROA(RPKI_Exception): 00273 """ 00274 Couldn't find a covering certificate to generate ROA. 00275 """ 00276 00277 class BSCNotReady(RPKI_Exception): 00278 """ 00279 BSC not yet in a usable state, signing_cert not set. 00280 """ 00281 00282 class HTTPSUnexpectedState(RPKI_Exception): 00283 """ 00284 HTTPS event occurred in an unexpected state. 00285 """ 00286 00287 class HTTPSBadVersion(RPKI_Exception): 00288 """ 00289 HTTPS couldn't parse HTTP version. 00290 """ 00291 00292 class HandleTranslationError(RPKI_Exception): 00293 """ 00294 Internal error translating protocol handle -> SQL id. 00295 """ 00296 00297 class NoObjectAtURI(RPKI_Exception): 00298 """ 00299 No object published at specified URI. 00300 """ 00301 00302 class CMSContentNotSet(RPKI_Exception): 00303 """ 00304 Inner content of a CMS_object has not been set. If object is known 00305 to be valid, the .extract() method should be able to set the 00306 content; otherwise, only the .verify() method (which checks 00307 signatures) is safe. 00308 """