Asn1Element
Base ASN.1 data class. Can either be a primitive (holding a value), or a structure (holding other ASN.1 elements)
Inheritors
Properties
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.
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
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