Asn1

object Asn1(source)

Namespace object for ASN.1 builder DSL functions and utility functions for creating ASN.1 primitives

Functions

Link copied to clipboard

Creates an BIT STRING Asn1Primitive from bitSet. Left-Aligned and right-padded (see Asn1BitString)

Creates an BIT STRING Asn1Primitive from bytes

Link copied to clipboard

Adds a BOOL Asn1Primitive to this ASN.1 structure

Link copied to clipboard

Creates a new EXPLICITLY TAGGED ASN.1 structure as Asn1ExplicitlyTagged using tag.

Link copied to clipboard

Exception-free version of ExplicitlyTagged

Link copied to clipboard

Safe version on ExplicitlyTagged, wrapping the result into a KmmResult

Link copied to clipboard

Convenience helper to easily construct explicitly tagged elements. Shorthand for Tag(tagValue, constructed=true, tagClass=TagClass.CONTEXT_SPECIFIC)

Link copied to clipboard
fun GeneralizedTime(value: Instant): Asn1Primitive

Creates a GENERALIZED TIME Asn1Primitive from value

Link copied to clipboard
fun ImplicitTag(tagNum: ULong, tagClass: TagClass = TagClass.CONTEXT_SPECIFIC): Asn1Element.Tag

Convenience helper to easily construct implicitly tagged elements. Shorthand for Tag(tagValue, constructed=false, tagClass=TagClass.CONTEXT_SPECIFIC)

Link copied to clipboard
fun Int(value: Int): Asn1Primitive
fun Int(value: Long): Asn1Primitive
fun Int(value: UInt): Asn1Primitive
fun Int(value: ULong): Asn1Primitive

Creates an INTEGER Asn1Primitive from value

Link copied to clipboard

Create a NULL Asn1Primitive

Link copied to clipboard

Creates an OCTET STRING Asn1Element from bytes

Link copied to clipboard

OCTET STRING builder. The result of init is encapsulated into an ASN.1 OCTET STRING Asn1Structure

Link copied to clipboard

Creates a PRINTABLE STRING Asn1Primitive from value.

Link copied to clipboard

Creates a new SEQUENCE as Asn1Sequence. Use as follows:

Link copied to clipboard

Exception-free version of Sequence

Link copied to clipboard
fun SequenceSafe(root: Asn1TreeBuilder.() -> Unit): KmmResult<Asn1Sequence>

Safe version of Sequence, wrapping the result into a KmmResult

Link copied to clipboard
fun Set(root: Asn1TreeBuilder.() -> Unit): Asn1Set

Creates a new SET as Asn1Set. Elements are sorted by tag. Use as follows:

Link copied to clipboard
fun SetOf(root: Asn1TreeBuilder.() -> Unit): Asn1Set

Creates a new SET OF as Asn1Set. Tags of all added elements need to be the same. Elements are sorted by encoded value Use as follows:

Link copied to clipboard

Exception-free version of SetOf

Link copied to clipboard
fun SetOfSafe(root: Asn1TreeBuilder.() -> Unit): KmmResult<Asn1Set>

Safe version of SetOf, wrapping the result into a KmmResult

Link copied to clipboard

Exception-free version of Set

Link copied to clipboard
fun SetSafe(root: Asn1TreeBuilder.() -> Unit): KmmResult<Asn1Set>

Safe version of Set, wrapping the result into a KmmResult

Link copied to clipboard
fun UtcTime(value: Instant): Asn1Primitive

Creates a UTC TIME Asn1Primitive from value

Link copied to clipboard

Creates an UTF8 STRING Asn1Primitive from value