Asn1Sequence

ASN.1 SEQUENCE 0x30 (BERTags.SEQUENCE OR BERTags.CONSTRUCTED)

Parameters

children

the elements to put into this sequence

Inheritors

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

This structure's child elements

Link copied to clipboard

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.

Link copied to clipboard
open override val contentLengthLong: Long

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.

Link copied to clipboard

DER-encoded representation of this ASN.1 element.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard

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.

Link copied to clipboard

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.

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 Asn1OctetString

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 Asn1Sequence

Link copied to clipboard

Convenience function to cast this element to an Asn1SequenceOf

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 Asn1SetOf

Link copied to clipboard

Convenience function to cast this element to an Asn1Structure

Link copied to clipboard
inline fun <T> decodeAs(requireFullConsumption: Boolean = true, decoder: Asn1Structure.Iterator.() -> T): T

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.

Link copied to clipboard
inline fun <R> Asn1Structure.decodeRethrowing(requireFullConsumption: Boolean = true, decoder: Asn1Structure.Iterator.() -> R): R

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.

Link copied to clipboard
@JvmName(name = "encodeAllPemBlocksToPem")
fun Iterable<PemBlock>.encodeAllToPem(): String
@JvmName(name = "encodeAllPemEncodablesToPem")
fun Iterable<PemEncodable>.encodeAllToPem(): String
Link copied to clipboard
fun encodeTo(sink: Sink)
Link copied to clipboard
operator override fun equals(other: Any?): Boolean
Link copied to clipboard
override fun hashCode(): Int
Link copied to clipboard
open operator override fun iterator(): Asn1Structure.Iterator
Link copied to clipboard
fun prettyPrint(limit: Long = MAX_RENDER_CHARS): String

Verbose, indented human-readable tree, truncated at limit characters with a marker (see renderTo).

Link copied to clipboard
fun renderTo(out: Sink, pretty: Boolean, limit: Long)

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.

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

fun toString(limit: Long): String

Compact single-line rendering, truncated at limit characters with a marker (see renderTo).

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