Asn1TreeBuilder

Class Providing a DSL for creating arbitrary ASN.1 structures. You will almost certainly never use it directly, but rather use it as follows:

Sequence {
  +ExplicitlyTagged(1uL) {
    +Asn1Primitive(Asn1Element.Tag.BOOL, byteArrayOf(0x00)) //or +Asn1.Bool(false)
  }
  +Asn1.Set {
    +Asn1.Sequence {
      +Asn1.SetOf {
        +PrintableString("World")
        +PrintableString("Hello")
      }
      +Asn1.Set {
        +PrintableString("World")
        +PrintableString("Hello")
        +Utf8String("!!!")
      }

    }
  }
  +Asn1.Null()

  +ObjectIdentifier("1.2.603.624.97")

  +(Utf8String("Foo") withImplicitTag (0xCAFEuL withClass TagClass.PRIVATE))
  +PrintableString("Bar")

  //fake Primitive
  +(Asn1.Sequence { +Asn1.Int(42) } withImplicitTag (0x5EUL without CONSTRUCTED))

  +Asn1.Set {
    +Asn1.Int(3)
    +Asn1.Int(-65789876543L)
    +Asn1.Bool(false)
    +Asn1.Bool(true)
  }
  +Asn1.Sequence {
    +Asn1.Null()
    +Asn1String.Numeric("12345")
    +UtcTime(Clock.System.now())
  }
} withImplicitTag (1337uL withClass TagClass.APPLICATION)

Constructors

Link copied to clipboard
constructor()

Functions

Link copied to clipboard
operator fun Asn1Element.unaryPlus()

appends a single Asn1Element to this ASN.1 structure

operator fun Asn1Encodable<*>.unaryPlus()

appends a single Asn1Encodable to this ASN.1 structure