Introduce a new data structure TLV.Tag with an accompanying TagClass enum and a constructed flag to accurately represent arbitrary tags up to ULong.MAX_VALUE
Make all tag parameters ULong to reflect support for multi-byte tags
Remove DERTags
Revamp implicit tagging (there is still work to be done, but at least it supports CONSTRUCTED ASN.1 elements)
TLV.Tag
with an accompanyingTagClass
enum and aconstructed
flag to accurately represent arbitrary tags up toULong.MAX_VALUE
tag
parametersULong
to reflect support for multi-byte tagsDERTags
Int.Companion.decodeFromDer
->Int.Companion.decodeFromDerValue()
Long.Companion.decodeFromDer
->Long.Companion.decodeFromDerValue()
ULong.Companion.decodeFromDer
which can handle overlong inputs, as long as they start with a valid ULong encodingVerifier::verify
fromKmmResult<Unit>
toKmmResult<Success>
. Usage is unchanged.ConfirmationClaim
to represent Proof-of-Possesion Key Semantics for JWTsJsonWebToken
to implement Demonstrating Proof of PossessionJsonWebToken.confirmationKey
byJsonWebToken.confirmationClaim
, the implementation was wrongULong.toAsn1VarInt()
to encode ULongs into ASN.1 unsigned VarInts (not to be confused with multi^2_base'sUVarInt
!)decodeAsn1VarULong()
anddecodeAsn1VarUInt()
which can handle overlong inputs, as long as they start with a valid unsigned number encoding.Iterator<Byte>.decodeAsn1VarULong()
Iterable<Byte>.decodeAsn1VarULong()
ByteArray.decodeAsn1VarULong()
Iterator<Byte>.decodeAsn1VarUInt()
Iterable<Byte>.decodeAsn1VarUInt()
ByteArray.decodeAsn1VarUInt()
Asn1Element.parse()
, introducing new variants. This yields:Asn1Element.parse()
with the same semantics as beforeAsn1Element.parse()
alternative introduced, which takes aByteIterator
instead of aByteArray
Asn1Element.parseAll()
introduced, which consumes all bytes and returns a list of all ASN.1 elements (if parsing works)ByteIterator
ByteArray
Asn1Element.parseFirst()
introduced, which tries to only parse a single ASN.1 element from the input and leaves the rest untouched.ByteIterator
and returns the element; theByteIterator
is advanced accordinglyByteArray
and returns aPair
of(element, remainingBytes)
encodeToAsn1Primitive
to produce anAsn1Primitive
that can directly be DER-encodedencodeToAsn1ContentBytes
to produce the content bytes of a TLV primitive (the V in TLV)decodeToXXX
to be invoked on anAsn1Primitive
to decode a DER-encoded primitive into the target typedecodeFromAsn1ContentBytes
to be invoked on the companion of the target type to decode the content bytes of a TLV primitive (the V in TLV)runCatching
withcatching
to be extra-safe