parse

Parses the provided input into a single Asn1Element. Consumes all Bytes and throws if more than one Asn.1 Structure was found or trailing bytes were detected

Return

the parsed Asn1Element

Throws

on invalid input or if more than a single root structure was contained in the input


Deprecated

Use a ByteArray or (even better) a kotlinx.io Source as input when possible. This method copies all bytes from the input twice and is inefficient.

Replace with

source.readAsn1Element(); require(source.exhausted())

Convenience wrapper around parse, taking a ByteArray as source

See also