Asn1CustomStructure
ASN1 structure (i.e. containing child nodes) with custom tag
Constructors
ASN.1 CONSTRUCTED with custom tag
ASN.1 CONSTRUCTED with custom tag
Properties
This structure's child elements
Length (as a plain Int to work with it in code) of the contained data. Guarded: throws Asn1Exception if contentLengthLong exceeds Int.MAX_VALUE (a >2 GiB aggregate) rather than silently overflowing. For such elements use contentLengthLong.
Length of the contained data as a Long. This is the overflow-safe source of truth; for a primitive it is the size of the held bytes, for a structure the sum of the encoded sizes of all child nodes.
DER-encoded representation of this ASN.1 element.
Total number of bytes required to represent this element when encoding to ASN.1. Guarded: throws Asn1Exception if overallLengthLong exceeds Int.MAX_VALUE. For such elements use overallLengthLong.
Total number of bytes required to represent this element when encoding to ASN.1, as a Long. Computed arithmetically from the (sentinel-cached) contentLengthLong — no lazy, no materialized length array — so the length post-order (Asn1Structure.contentLengthLong) can sum children without per-node lock/allocation.
Indicates whether this structure should sort their child nodes by default. This is true for SET and for all custom structure that enforce SET semantics. Note that it is impossible to infer this property correctly when parsing custom structures. Therefore, it has no impact on equals.
Functions
Convenience function to cast this element to an Asn1EncapsulatingOctetString
Convenience function to cast this element to an Asn1ExplicitlyTagged
Convenience function to cast this element to an Asn1OctetString
Convenience function to cast this element to an Asn1Primitive
Convenience function to cast this element to an Asn1Sequence
Convenience function to cast this element to an Asn1SequenceOf
Convenience function to cast this element to an Asn1Structure
Decodes the content of this ASN.1 structure using the provided decoder lambda. This function gives a convenient way to decode ASN.1 structures by exposing an iterator over the structure's children to the decoder lambda. Optionally, it enforces that all children must be consumed. Use decodeRethrowing to automatically and consistently wrap exceptions thrown during decoding in Asn1Exceptions.
Decodes this ASN.1 structure using the provided decoder lambda, rethrowing any caught exception as an Asn1Exception. This is a wrapper around Asn1Structure.decodeAs that ensures exceptions thrown during decoding are consistently rethrown as Asn1Exception, using the runRethrowing utility.
Stack-safe renderer that writes this element's compact (pretty = false) or indented (pretty = true) string form as UTF-8 into out, stopping after limit characters (appending a truncation marker). Expressed with DeepRecursiveFunction so deep nesting cannot overflow the call stack; reuses the per-node prettyPrintHeader/prettyPrintTrailer/contentToString so output is unchanged for ordinary elements.
Convenience method to directly produce an HEX string of this element's ASN.1 representation
Creates a new implicitly tagged ASN.1 Element from this ASN.1 Element. NOTE: The TagClass of the provided tag will be used! If you want the result to have TagClass.CONTEXT_SPECIFIC, use element withImplicitTag (tag withClass TagClass.CONTEXT_SPECIFIC)!. If a CONSTRUCTED Tag is applied to an ASN.1 Primitive, the CONSTRUCTED bit is overridden and set to zero.
Creates a new implicitly tagged ASN.1 Element from this ASN.1 Structure. If the provided template's tagClass is not set, the class of the resulting structure defaults to TagClass.CONTEXT_SPECIFIC. If a CONSTRUCTED Tag is applied to an ASN.1 Primitive, the CONSTRUCTED bit is overridden and set to zero.
Creates a new implicitly tagged ASN.1 Element from this ASN.1 Element. Sets the class of the resulting structure to TagClass.CONTEXT_SPECIFIC