Module osyspyrt.asn1error
Define Exception classes.
Classes
class Asn1ConsVioError (varname, value)
-
This class defines the 'ASN.1 constraint violation' exception that is thrown when an element is parsed that is outside the bounds to a defined constraint.
The constructor creates an exception object with a standard message based on the given variable name and value. The form of the message is 'Element <varname> with value <value> violates defined constraint'.
Parameters
varname
:str
- Name of variable.
value
:any
- Value object that violated constraint.
Ancestors
- Asn1Error
- builtins.Exception
- builtins.BaseException
class Asn1EndOfBufferError
-
This class defines the 'ASN.1 end of buffer' exception that is thrown when an unexpected end-of-buffer condition is encountered when decoding a message.
Ancestors
- Asn1Error
- builtins.Exception
- builtins.BaseException
class Asn1Error (*args, **kwargs)
-
This is the base class for ASN.1 run-time errors.
Ancestors
- builtins.Exception
- builtins.BaseException
Subclasses
- Asn1EndOfBufferError
- Asn1LimitationError
- Asn1MissingRequiredError
- Asn1SeqOrderError
- Asn1NotInSetError
- Asn1SetDuplicateError
- Asn1TagError
- Asn1LengthError
- Asn1ConsVioError
- Asn1InvalidEnumError
- Asn1InvalidElemError
- Asn1InvalidObjectID
- Asn1InvalidStringError
- Asn1UnexpectedElementError
- Asn1InvalidChoiceOptionError
- Asn1InvalidTCIndexError
class Asn1InvalidChoiceOptionError
-
This class defines the 'ASN.1 invalid choice option' exception that is thrown when a CHOICE construct is detected to contain an element that is not within the given set.
This constructor creates an exception object with a default textual message.
Ancestors
- Asn1Error
- builtins.Exception
- builtins.BaseException
class Asn1InvalidElemError (elem_name)
-
This class defines the 'ASN.1 invalid elem' exception that is thrown when an invalid element is encountered.
Ancestors
- Asn1Error
- builtins.Exception
- builtins.BaseException
class Asn1InvalidEnumError (value)
-
This class defines the 'ASN.1 invalid enum' exception that is thrown when an enumerated value is not within the defined set of values.
Ancestors
- Asn1Error
- builtins.Exception
- builtins.BaseException
class Asn1InvalidObjectID (*args, **kwargs)
-
This error is raised when a problem is detected with an object identifier.
Ancestors
- Asn1Error
- builtins.Exception
- builtins.BaseException
class Asn1InvalidStringError (name, value)
-
This class defines the 'ASN.1 invalid string contents' exception that is raised from BER/DER methods when a string contains characters that it shouldn't (such as a NumericString containing a letter)…
The constructor sets the error message in the exception.
Parameters
charstr
:string
- Name of the string containing an invalid character.
Ancestors
- Asn1Error
- builtins.Exception
- builtins.BaseException
class Asn1InvalidTCIndexError (value)
-
This class defines the 'ASN.1 invalid table constraint index' exception that is thrown when the value provided to index into a table does not match any of the defined index values.
This constructor creates an exception object with a default textual message.
Ancestors
- Asn1Error
- builtins.Exception
- builtins.BaseException
class Asn1LengthError (*args, **kwargs)
-
This error is raised when there is an error related to BER lengths, such as having an indefinite length for a primitive encoding.
Ancestors
- Asn1Error
- builtins.Exception
- builtins.BaseException
class Asn1LimitationError (*args, **kwargs)
-
This class is used when a limit of the implementation is reached. An example is when an encoded value is outside the range of values supported by the implementation.
Ancestors
- Asn1Error
- builtins.Exception
- builtins.BaseException
class Asn1MissingRequiredError (elemname)
-
This class defines the 'ASN.1 set missing required element' exception that is raised from BER/DER methods when a SEQUENCE or SET construct is decoded and found to be missing a required element.
The constructor sets the error message in the exception.
Parameters
elemname
:string
- Name of the missing required element.
Ancestors
- Asn1Error
- builtins.Exception
- builtins.BaseException
class Asn1NotInSetError (tag)
-
This class defines the 'ASN.1 element not in set' exception that is raised from BER/DER methods when an element is parsed within the context of a SET that does not belong to the set.
The constructor sets the error message in the exception.
Parameters
tag
:Asn1BerTag
- Tag value of duplicate element.
Ancestors
- Asn1Error
- builtins.Exception
- builtins.BaseException
class Asn1SeqOrderError
-
This class defines the 'ASN.1 sequence order' exception that is raised when an element is received in a SEQUENCE construct that is not in the correct order or is unknown.
The constructor sets the error message in the exception.
Ancestors
- Asn1Error
- builtins.Exception
- builtins.BaseException
class Asn1SetDuplicateError (tag)
-
This class defines the 'ASN.1 set duplicate element' exception that is raised from BER/DER methods when a SET construct is detected to contains more than one instance of a given tagged element.
The constructor sets the error message in the exception.
Parameters
tag
:Asn1BerTag
- Tag value of duplicate element.
Ancestors
- Asn1Error
- builtins.Exception
- builtins.BaseException
class Asn1TagError (*args, **kwargs)
-
This error is raised when there is an error related to BER tags, such as the wrong tag identifier having been encoded.
Ancestors
- Asn1Error
- builtins.Exception
- builtins.BaseException
class Asn1UnexpectedElementError
-
This class defines the ASN.1 unexpected element exception that is thrown when an unexpected element is detected.
This exception may be thrown when an element is decoded in a SEQUENCE or SET that was not specified in the input grammar. This is distinguished from the Asn1SeqOrderError which is thrown when elements are decoded out of order.
This constructor creates an exception object with a default textual message.
TODO: tags for the expected and actual element should be passed and included in the output text.
Ancestors
- Asn1Error
- builtins.Exception
- builtins.BaseException