OBJECT IDENTIFIER and RELATIVE-OID

A Python class is generated for an ASN.1 OBJECT IDENTIFIER or RELATIVE-OID type only if the type is tagged. This is only true for BER/DER encoding rules; in other cases, no class is generated.

If a class is generated, it will contain static methods for the BER encoding or decoding of an OID value.

Example ASN.1:

OID ::= [APPLICATION 2] OBJECT IDENTIFIER

Generated Python Class:

class OID:
    @staticmethod
    def ber_decode(decbuf, explicit=True, impllen=None):
    ...

    @staticmethod
    def ber_encode(value, encbuf, explicit=True):
    ...

The value that is returned by the decode method or passed into the encode method is a Python integer list value. The list contains the arcs for the OID value.

See the BER encode/decode methods for information on how to call these methods.