Package-level declarations

Functions

Link copied to clipboard

Decodes an unsigned BigInteger from bytes using varint encoding as used within ASN.1: groups of seven bits are encoded into a byte, while the highest bit indicates if more bytes are to come. Trailing bytes are ignored.

fun Source.decodeAsn1VarBigInt(): Pair<BigInteger, ByteArray>

Decodes an ASN.1 unsigned varint to a BigInteger, copying all bytes from the source into a ByteArray.

Link copied to clipboard
fun BigInteger.Companion.decodeFromAsn1ContentBytes(bytes: ByteArray): BigInteger

Decodes a BigInteger from bytes assuming the same encoding as the Asn1Primitive.content property of an Asn1Primitive containing an ASN.1 INTEGER

Link copied to clipboard
fun Asn1Primitive.decodeToBigInteger(assertTag: Asn1Element.Tag = Asn1Element.Tag.INT): BigInteger

Decode the Asn1Primitive as a BigInteger. assertTag defaults to Asn1Element.Tag.INT, but can be overridden (for implicitly tagged integers, for example)

Link copied to clipboard
inline fun Asn1Primitive.decodeToBigIntegerOrNull(assertTag: Asn1Element.Tag = Asn1Element.Tag.INT): BigInteger?

Exception-free version of decodeToBigInteger

Link copied to clipboard

Encodes this number into a ByteArray using the same encoding as the Asn1Primitive.content property of an Asn1Primitive containing an ASN.1 INTEGER

Link copied to clipboard

Produces an INTEGER as Asn1Primitive

Link copied to clipboard
fun Uuid.Companion.fromBigintOrNull(bigInteger: BigInteger): Uuid?

Tries to convert a BigInteger to a UUID. Only guaranteed to work with BigIntegers that contain the unsigned (positive) integer representation of a UUID, chances are high, though, that it works with random positive BigIntegers between 16 and 14 bytes long.

Link copied to clipboard
fun Asn1.Int(value: BigInteger): Asn1Primitive

Creates an INTEGER Asn1Primitive from value

Link copied to clipboard
fun BigInteger.toAsn1VarInt(): ByteArray

Encodes this number using varint encoding as used within ASN.1: groups of seven bits are encoded into a byte, while the highest bit indicates if more bytes are to come

Link copied to clipboard
fun Uuid.toBigInteger(): BigInteger

Converts this UUID to a BigInteger representation

Link copied to clipboard
fun Sink.writeAsn1VarInt(number: BigInteger): Int

Encodes this number using varint encoding as used within ASN.1: groups of seven bits are encoded into a byte, while the highest bit indicates if more bytes are to come