INTEGER

The ASN.1 INTEGER type represents an arbitrary-precision signed integer value.

In Python, the generated INTEGER class wraps the native int type, providing encoding, decoding, and constraint checks compliant with ASN.1 rules.

Example ASN.1 definition:

MyInteger ::= INTEGER

which generates a Python class roughly equivalent to:

class MyInteger(_Asn1BasicType[int]):
    pass

Conceptual Representation

class _Asn1BasicType[int]

Represents an INTEGER ASN.1 type.

__init__(self, value: int | None = None) None

Initializes the INTEGER instance with an optional initial value.

property value: int

Gets or sets the integer value.

Setting the value accepts any Python object coercible to int.

ENUMERATED

ASN.1 also supports named INTEGER values using the ENUMERATED type, where each integer constant is given a symbolic name.

Example ASN.1 enumeration:

MyEnum ::= ENUMERATED {
    red(0),
    green(1),
    blue(2)
}

-- or --
MyEnum ::= INTEGER {
    red(0),
    green(1),
    blue(2)
}

This generates a Python class similar to:

class MyEnum(_Asn1EnumType):
    class VALUES(enum.IntEnum):
        V_red = 0
        V_green = 1
        V_blue = 2

Represented via _Asn1EnumType.