Google

LINK="#0000bb" VLINK="#551a8b" ALINK="#ff0000">

ASN.1 universal data types

The pysnmp.asn1.univ module implements so-called "universal" ASN.1 types as defined by ASN.1 standard.

The following classes implement simple ASN.1 types:

class Boolean([value])

Instances of this class represent ASN.1 BOOLEAN data type. This is a subclass of base.SimpleAsn1Object class, with additional methods (see below) and the following deviations from the base class:

  • ASN.1 tag set to 0x01
  • Single value constraint set to [0, 1]
  • Python type constraint set to [IntType, LongType]

The default value for Boolean object is 0 (false).

class Integer([value])

Instances of this class represent ASN.1 INTEGER data type. This is a subclass of base.SimpleAsn1Object class, with additional methods (see below) and the following deviations from the base class:

  • ASN.1 tag set to 0x02
  • Python type constraint set to [IntType, LongType]

The default value for Integer object is 0L.

class BitString([value])

Instances of this class represent ASN.1 BITSTRING data type. This is a subclass of base.SimpleAsn1Object class, with the following deviations from the base class:

  • ASN.1 tag set to 0x03
  • Python type constraint set to [StringType]

class OctetString([value])

Instances of this class represent ASN.1 OCTETSTRING data type. This is a subclass of base.SimpleAsn1Object class, with additional methods (see below) and the following deviations from the base class:

  • ASN.1 tag set to 0x04
  • Python type constraint set to [StringType]

class Null([value])

Instances of this class represent ASN.1 NULL data type. This is a subclass of base.SimpleAsn1Object class, with the following deviations from the base class:

  • ASN.1 tag set to 0x05
  • Single value constraint set to [0, 0L, '', None]
  • Python type constraint set to [IntType, LongType, StringType, NoneType]

class ObjectIdentifier([value])

Instances of this class represent ASN.1 OBJECT IDENTIFIER data type. This is a subclass of base.SimpleAsn1Object class, with additional methods (see below) and the following deviations from the base class:

  • ASN.1 tag set to 0x06
  • Python type constraint set to [StringType, ListType]

The ObjectIdentifier objects operate with ASN.1 OBJECT IDENTIFIER values given as string (in '1.3.4' like notation) or list of integers ([1, 3, 4]).

The following classes inplement structured ASN.1 types:

class Sequence([**kwargs])

Instances of this class represent ASN.1 SEQUENCE data type. This is a subclass of base.RecordTypeAsn1Object class, with the following deviations from the base class:

  • ASN.1 tag set to 0x10

class SequenceOf([args])

Instances of this class represent ASN.1 SEQUENCE OF data type. This is a subclass of base.VariableTypeAsn1Object class, with the following deviations from the base class:

  • ASN.1 tag set to 0x10

class Set([**kwargs])

Instances of this class represent ASN.1 SET data type. This is a subclass of base.RecordTypeAsn1Object class, with the following deviations from the base class:

  • ASN.1 tag set to 0x11

class SetOf([args])

Instances of this class represent ASN.1 SET OF data type. This is a subclass of base.VariableTypeAsn1Object class, with the following deviations from the base class:

  • ASN.1 tag set to 0x11

class Choice([**kwargs])

Instances of this class represent ASN.1 CHOICE data type. This is a subclass of base.ChoiceTypeAsn1Object class, with the following deviations from the base class:

  • Tag category set to 'UNTAGGED'

Methods of the above classes may raise exceptions based on error.Asn1Error base class.


Subsections


ilya@glas.net