SimpleAsn1Type type

class pyasn1.type.base.SimpleAsn1Type(value=NoValue(), tagSet=TagSet(), subtypeSpec=ConstraintsIntersection())

Base class for all simple classes representing ASN.1 types.

ASN.1 distinguishes types by their ability to hold other objects. Scalar types are known as simple in ASN.1.

In the user code, SimpleAsn1Type class is normally used only for telling ASN.1 objects from others.

Note

For as long as ASN.1 is concerned, a way to compare ASN.1 types is to use isSameTypeWith() and isSuperTypeOf() methods.

property isValue

Indicate that SimpleAsn1Type object represents ASN.1 value.

If isValue is False then this object represents just ASN.1 schema.

If isValue is True then, in addition to its ASN.1 schema features, this object can also be used like a Python built-in object (e.g. int, str, dict etc.).

Returns

boolFalse if object represents just ASN.1 schema. True if object represents ASN.1 schema and can be used as a normal value.

Note

There is an important distinction between PyASN1 schema and value objects. The PyASN1 schema objects can only participate in ASN.1 schema-related operations (e.g. defining or testing the structure of the data). Most obvious uses of ASN.1 schema is to guide serialisation codecs whilst encoding/decoding serialised ASN.1 contents.

The PyASN1 value objects can additionally participate in many operations involving regular Python objects (e.g. arithmetic, comprehension etc).

isSameTypeWith(other, matchTags=True, matchConstraints=True)

Examine SimpleAsn1Type type for equality with other ASN.1 type.

ASN.1 tags (tag) and constraints (constraint) are examined when carrying out ASN.1 types comparison.

Python class inheritance relationship is NOT considered.

Parameters

other (a pyasn1 type object) – Class instance representing ASN.1 type.

Returns

boolTrue if other is SimpleAsn1Type type, False otherwise.

isSuperTypeOf(other, matchTags=True, matchConstraints=True)

Examine SimpleAsn1Type type for subtype relationship with other ASN.1 type.

ASN.1 tags (tag) and constraints (constraint) are examined when carrying out ASN.1 types comparison.

Python class inheritance relationship is NOT considered.

Parameters

other (a pyasn1 type object) – Class instance representing ASN.1 type.

Returns

boolTrue if other is a subtype of SimpleAsn1Type type, False otherwise.

tagSet = <TagSet object, untagged>

Set or return a TagSet object representing ASN.1 tag(s) associated with SimpleAsn1Type type.

property effectiveTagSet

For SimpleAsn1Type type is equivalent to tagSet

property tagMap

Return a TagMap object mapping ASN.1 tags to ASN.1 objects within callee object.

subtypeSpec = <ConstraintsIntersection object>

Default ConstraintsIntersection object imposing constraints on initialization values.