decodeFromDer

fun <A : Asn1Element, T : Asn1Encodable<A>> Asn1Decodable<A, T>.decodeFromDer(source: Source, limit: Long, assertTag: Asn1Element.Tag? = null): T(source)

Decodes an ASN.1 object of type T from a DER-encoded source.

Return

The decoded ASN.1 object of type T.

Parameters

source

The source from which the DER-encoded data will be read.

limit

The maximum allowed total number of encoded DER bytes to consume. This limit is enforced before reading or peeking from the underlying source.

assertTag

Optional. If provided, ensures that the decoded element matches this tag.

Throws

if the input does not parse or if it exceeds the specified limit. This includes length encoding indicating a length greater than limit, even if this is malformed and exceeds the number of bytes left in the source.