tlslite.utils.asn1parser module

Abstract Syntax Notation One (ASN.1) parsing

class tlslite.utils.asn1parser.ASN1Parser(bytes)

Bases: object

Parser and storage of ASN.1 DER encoded objects.

Variables:
  • length (int) – length of the value of the tag
  • value (bytearray) – literal value of the tag
__init__(bytes)

Create an object from bytes.

Parameters:bytes (bytearray) – DER encoded ANS.1 object
getChild(which)

Return n-th child assuming that the object is a SEQUENCE.

Parameters:which (int) – ordinal of the child to return
Return type:ASN1Parser
Returns:decoded child object
getChildBytes(which)

Return raw encoding of n-th child, assume self is a SEQUENCE

Parameters:which (int) – ordinal of the child to return
Return type:bytearray
Returns:raw child object
getChildCount()

Return number of children, assuming that the object is a SEQUENCE.

Return type:int
Returns:number of children in the object