Tag set¶
- class pyasn1.type.tag.TagSet(baseTag=(), *superTags)¶
Create a collection of ASN.1 tags
Represents a combination of
Tag
objects that can be attached to a ASN.1 type to make types distinguishable from each other.TagSet objects are immutable and duck-type Python
tuple
objects holding arbitrary number ofTag
objects.- Parameters
Examples
class OrderNumber(NumericString): ''' ASN.1 specification Order-number ::= [APPLICATION 5] IMPLICIT NumericString ''' tagSet = NumericString.tagSet.tagImplicitly( Tag(tagClassApplication, tagFormatSimple, 5) ) orderNumber = OrderNumber('1234')
Note
The TagSet objects are normally used by all ASN.1 type objects both simple (like Integer) and constructed (e.g. Sequence).
- property superTags¶
Return ASN.1 tags
- tagExplicitly(superTag)¶
Return explicitly tagged TagSet
Create a new TagSet representing callee TagSet explicitly tagged with passed tag(s). With explicit tagging mode, new tags are appended to existing tag(s).
- tagImplicitly(superTag)¶
Return implicitly tagged TagSet
Create a new TagSet representing callee TagSet implicitly tagged with passed tag(s). With implicit tagging mode, new tag(s) replace the last existing tag.
- isSuperTagSetOf(tagSet)¶
Test type relationship against given TagSet
The callee is considered to be a supertype of given TagSet tag-wise if all tags in TagSet are present in the callee and they are in the same order.