Objects of the asn1.OCTETSTRING and asn1.OPAQUE classes.

Instances of the asn1.OCTETSTRING and asn1.OPAQUE classes have the following methods:

encode([value])

The encode method converts the content of the class instance into BER octet-stream (string).

The value parameter, whenever given for last-minute payload assignment to class instance, must be a string.

decode(data)

The decode method attempts to convert the data octet-stream (string) into an octet string value, and returns a tuple of (a_class_instance, rest).

Any unprocessed part of data octet-stream is returned in the rest string.

The data octet-stream must carry an ASN.1 octet string or opaque value or a error.TypeError exception would be thrown.

update(value)

The update method assigns the value to class instance payload, which must be a string.

__call__()

Class instance invocation would return currently stored payload.

__cmp__(other)

Class instances may be compared against each other. The comparation would return negative if other is greater, zero on equivalence, positive if other is less.

__repr__()

Returns the canonical string representation of the class instance.

__str__()

Returns a nice string representation of the class instance.


ilya@glas.net