Module osyspyrt.asn1evthndlr
Define classes supporting event handling.
Classes
class Asn1BerMessageDumpHandler
-
This implementation of an Asn1TaggedEventHandler can be used to get a formatted dump of an ASN.1 BER-encoded message in a human readable format.
The dump is done into the strbuf attribute.
Ancestors
Class variables
var MAXBYTESPERLINE
var lengthStack
var offset
var strbuf
Methods
def contents(self, data)
-
This method is invoked after each contents field is parsed. It formats and prints the contents in a hex/ascii format.
Parameters
data
:bytes
- Byte array containing encoded contents bytes.
def end_element(self)
-
This method is invoked after parsing is complete on each tag/length/value (TLV) in the message.
def start_element(self, tag, length, tagLenBytes)
-
This method is invoked after each tag/length value is parsed in the message being dumped. It formats and prints the tag/length values.
Parameters
tag
:Asn1BerTag
- Parsed tag value
length
:Asn1BerLength
- Parsed length value
tagLenBytes
:bytes
- Byte array containing the encoded tag/length bytes
class Asn1TaggedEventHandler
-
This class defines methods that must be implemented to define a SAX-like tagged event handler.
A tagged event handler returns tags from within a BER or DER message. This type of handler can be used to generically parse a message without knowledge of the associated ASN.1 schema definition. It is used in conjunction with the Asn1BerDecodeBuffer 'parse' method.
Subclasses
Methods
def contents(self, data)
-
The contents callback method is invoked when the contents of a primitive data element are parsed.
Parameters
data
:bytes
- Byte array containing encoded contents bytes.
def end_element(self)
-
The endElement callback method is invoked when the end of a tagged element is parsed.
def start_element(self, tag, length, tagLenBytes)
-
The startElement callback method is invoked when the start of any tagged element is parsed.
Parameters
tag
:Asn1BerTag
- Parsed tag value
length
:Asn1BerLength
- Parsed length value
tagLenBytes
:bytes
- Byte array containing the encoded tag/length bytes