# Standard Telecom Module

The Standard Telecom module is an original implementation of various standards managed by the International Telecommunictaion Union (ITU). At the heart of this module is the Abstract Syntax Notation (ASN.1) which is widely used to model data records and store certificates.

## Abstract syntax notation

The abstract syntax notation (ASN.1) is standardized by the ITU to express a normal form of communication. The ASN.1 is in fact the de-facto standard for representing X509 certificate and is the only justification to provide the support for such complex representation.

## Encoding rules

This implementation supports all encoding forms as defined by the ITU, namely the Basic Encoding Rule (BER), the Canonical Encoding Rule (CER) and the Distinguished Encoding Rule (DER). The DER form is by far the most widely used.

## ASN objects

All objects as defined by the ITU are supported in this implementation, including the ability to create custom OID.

## ASN objects

Object | Description
--- | ---
AsnBoolean | Boolean primitive
AsnInteger | Integer primitive
AsnBits | Bit string
AsnOctets | Octet string
AsnBmp | Bmp string
AsnIas | IA5 string
AsnNums | Numeric string
AsnPrts | Printable string
AsnUtfs | Unicode string
AsnUnvs | Universal string
AsneNull | Null primitive
AsneEoc | End-of-Content primitive
AsnGtm | Generalized time primitive
AsnUtc | Utc time primitive
AsnSequence | Asn node Sequence
AsnSet | Asn node Set
AsnOid | Asn object identifier Set
AsnRoid | Asn object relative identifier Set

## Using ASN.1 objects

Using ASN.1 object is particularly straightfoward. One can directly creates a particular object by invoking the appropriate constructor.

# create an asn boolean node trans abn (afnix:itu:AsnBoolean true) # check the node type assert true (afnix:itu:asn-node-p abn) assert true (afnix:itu:asn-boolean-p abn)

Writing the object can be done into a buffer or an output stream. Note that the default encoding is the DER encoding.

# write into a buffer trans buf (Buffer) abn:write buf # check the buffer content assert "0101FF" (buf:format)

Building an ASN.1 representation can be achieved by parsing a buffer or an input stream. This is done by filling a buffer and requesting a buffer node mapping.

# parse the buffer and check const anb (afnix:itu:AsnBuffer buf) # map the node to a boolean trans abn (anb:node-map) # check the node assert true (afnix:itu:asn-node-p abn) assert true (afnix:itu:asn-boolean-p abn)

With more complex structure, it is likely that a sequence object will be returned by the buffer node mapper. Once the sequence object is created, each node can be accessed by index like any other container.