Character String Types

ASN.1 character string types include fixed 8-bit character string types (IA5String, PrintableString, NumericString, etc.), variable-length character size types (UTF8String), and 16-bit wide character string types (BMPString) and 32-bit wide character string types (UniversalString). A Python class is generated for these types only if the following are true:

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

Example ASN.1:

CharStr ::= IA5String (SIZE(1..5))

Generated Python Class:

class CharStr:
    @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 string.

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