type

AsnObjBuilder

class AsnObjBuilder : Obj

Utility to build an AsnObj

constructors

methods

asnEnum

Build an ASN.1 Enumerated value.

asnNull

Build an ASN.1 Null value

bits

Build an ASN.1 Bit String value.

bool

Build an ASN.1 Boolean value

genTime

Build an ASN.1 GeneralizedTime value.

int

Build an ASN.1 Integer value.

octets

Build an ASN.1 Octet String value.

oid

Build an ASN.1 Object Identifier value (OID).

seq

Build an ASN.1 SEQUENCE value The items parameter may be

set

Create an ASN.1 SET value The items parameter may be any of the values accepted by seq.

str

Build one of the ASN.1 string types.

tag

Add a tag to the object builder.

utc

Build an ASN.1 UTCTime value

utf8

Build an ASN.1 Utf8String value.

Slot Details

asnEnum

AsnObj asnEnum(Int val)

Build an ASN.1 Enumerated value.

asnNull

AsnObj asnNull()

Build an ASN.1 Null value

bits

AsnObj bits(Buf bits)

Build an ASN.1 Bit String value. The bits in the bit string are numbered from left to right. For example, bits 0-7 are in the first byte of the bits buffer.

bool

AsnObj bool(Bool val)

Build an ASN.1 Boolean value

genTime

AsnObj genTime(DateTime ts)

Build an ASN.1 GeneralizedTime value.

int

AsnObj int(Obj val)

Build an ASN.1 Integer value. The val may be either an Int or a BigInt, but is always normalized to BigInt.

make

new make()

octets

AsnObj octets(Obj val)

Build an ASN.1 Octet String value. The val may be:

  • a Str - it will be converted to a Buf as ((Str)val).toBuf
  • a Buf containing the raw octets

oid

AsnOid oid(Obj val)

Build an ASN.1 Object Identifier value (OID). The val may be:

  1. an Int[] where each element of the list is a part of the oid.
  2. a Str where each part of the oid is separated by ..
Asn.oid([1,2,3])
Asn.oid("1.2.3")

seq

AsnSeq seq(Obj items)

Build an ASN.1 SEQUENCE value The items parameter may be:

  • An AsnItem[] of raw items to add to the collection
  • An AsnObj[]
  • A Str:AsnObj - if the order of the sequence is important, you should ensure the map is ordered.

set

AsnSet set(Obj items)

Create an ASN.1 SET value The items parameter may be any of the values accepted by seq.

str

AsnObj str(Str val, AsnTag univ)

Build one of the ASN.1 string types. The univ parameter must be one of:

See utf8 to easily create UTF-8 strings.

tag

This tag(AsnTag? tag)

Add a tag to the object builder. Tags should be added in ther order they are specified in an ASN.1 type declaration. If the tag is null, then this is a no-op.

Whenever a concrete AsnObj is built, the builder will clear all tags.

// [0] [1 APPLICATION] Boolean
obj := AsnObjBuilder()
   .tag(AsnTag.context(0).implicit)
   .tag(AsnTag.app(1).implicit)
   .bool(true)

utc

AsnObj utc(DateTime ts)

Build an ASN.1 UTCTime value

utf8

AsnObj utf8(Str val)

Build an ASN.1 Utf8String value.