Asn1Structure

ASN.1 structure. Contains no data itself, but holds zero or more children

Inheritors

Properties

Link copied to clipboard
Link copied to clipboard

Lazily-evaluated DER-encoded representation of this ASN.1 element

Link copied to clipboard

Length (already properly encoded into a byte array for writing as ASN.1) of the contained data. For a primitive, this is just the size of the held bytes. For a structure, it is the sum of the number of bytes needed to encode all held child nodes.

Link copied to clipboard

indicated whether the structure's children are actually sorted. This could be false for parsing non-compliant SETs, for example.

Link copied to clipboard
open override val length: Int

Length (as a plain Int to work with it in code) of the contained data. For a primitive, this is just the size of the held bytes. For a structure, it is the sum of the number of bytes needed to encode all held child nodes.

Link copied to clipboard

Total number of bytes required to represent the ths element, when encoding to ASN.1.

Link copied to clipboard

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.

Link copied to clipboard

Functions

Link copied to clipboard

Convenience function to cast this element to an Asn1EncapsulatingOctetString

Link copied to clipboard

Convenience function to cast this element to an Asn1ExplicitlyTagged

Link copied to clipboard

Convenience function to cast this element to an Asn1Primitive

Link copied to clipboard

Convenience function to cast this element to an Asn1PrimitiveOctetString

Link copied to clipboard

Convenience function to cast this element to an Asn1Sequence

Link copied to clipboard
fun asSet(): Asn1Set

Convenience function to cast this element to an Asn1Set

Link copied to clipboard

Convenience function to cast this element to an Asn1Structure

Link copied to clipboard
open operator override fun equals(other: Any?): Boolean

the shouldBeSorted flag has no bearing on equals!

Link copied to clipboard
open override fun hashCode(): Int
Link copied to clipboard

Returns true if more children can be retrieved by nextChild. false otherwise

Link copied to clipboard

Returns the next child held by this structure. Useful for iterating over its children when parsing complex structures.

Link copied to clipboard

Exception-free version of nextChild

Link copied to clipboard

Returns the current child or null, if there are no children left (useful when iterating over this structure's children).

Link copied to clipboard
Link copied to clipboard
fun toDerHexString(lineLen: Int? = null): String

Convenience method to directly produce an HEX string of this element's ASN.1 representation

Link copied to clipboard
open override fun toString(): String
Link copied to clipboard

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.

infix inline fun withImplicitTag(tagValue: ULong): Asn1Element

Creates a new implicitly tagged ASN.1 Element from this ASN.1 Element. Sets the class of the resulting structure to TagClass.CONTEXT_SPECIFIC