itu(3)

πŸ“¦
version 3.8.0 Β· 3 versions
, in debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– itu(3) β€” standard telecom module πŸ’–

okay bestie, buckle up β€” this is the manual page for itu(3) from the Library Functions Manual, and it's a whole vibe. Let's get into it. πŸ¦‹


✨ NAME ✨

itu β€” standard telecom module


🌸 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. it's giving backbone energy fr fr

πŸŽ€ 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. iykyk

🧚 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. main character encoding honestly πŸ‘‘

πŸ“ ASN objects

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

  • 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. so easy it's basically cheating

# 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. default queen behavior

# 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. very demure, very mindful ✨


πŸ‘‘ STANDARD TELECOM REFERENCE πŸ‘‘

🌈 AsnNode

The AsnNode class is the base class used to represent the asn tree. The structure of the node is defined in ITU-T X.690 recommendation. This implementation supports 64 bits tag number with natural machine length encoding. The Canonical Encoding Rule (CER) and Distinguished Encoding Rule (DER) are defined by the class. Since ASN.1 provides several encoding schemes, the class is designed to be as generic as possible but does not provides the mechanism for changing from one representation to another β€” although it is perfectly valid to read a DER representation and write it in the CER form. ngl that last part is lowkey iconic

Predicate

  • asn-node-p

Inheritance

  • Object

Constants

  • BER β€” The BER constant defines the Basic Encoding Rule node encoding.
  • CER β€” The CER constant defines the Canonical Encoding Rule node encoding.
  • DER β€” The DER constant defines the Distinguished Encoding Rule node encoding.
  • UNIVERSAL β€” The UNIVERSAL constant defines the node universal class.
  • APPLICATION β€” The APPLICATION constant defines the node application class.
  • CONTEXT-SPECIFIC β€” The CONTEXT-SPECIFIC constant defines the node context specific class.
  • PRIVATE β€” The PRIVATE constant defines the node private class.

Methods

  • reset -> none (none) β€” The reset method reset a node to its default value.
  • length -> Integer (none) β€” The length method returns the total node length in bytes.
  • get-class -> UNIVERSAL|APPLICATION|CONTEXT-SPECIFIC|PRIVATE (none) β€” The get-class method returns the node class.
  • primitive-p -> Boolean (none) β€” The primitive-p returns true if the node is a primitive.
  • constructed-p -> Boolean (none) β€” The constructed-p returns true if the node is a constructed node.
  • get-tag-number -> Integer (none) β€” The get-tag-number-p returns node tag number.
  • get-content-length -> Integer (none) β€” The get-content-length-p returns node content length.
  • write -> none (none|OutputStream|Buffer) β€” The write method write the asn node contents as well as the child nodes to an output stream argument or a buffer. Without argument, the node is written to the interpreter output stream. With one argument, the node is written to the specified stream or buffer.

πŸŽ€ AsnOctets

The AsnOctets class is the asn object class that encodes the octet string type. This type can be encoded either as a primitive or as constructed at sender's option. In CER form, the primitive form is used when the content length is less than 1000 octets, and the constructed form is used otherwise. The DER form will always use the primitive form. no cap, DER does not play around

Predicate

  • asn-octets-p

Inheritance

  • AsnNode

Constructors

  • AsnOctets (none) β€” The AsnOctets constructor creates a default asn octets string node.
  • AsnOctets (String|Buffer) β€” The AsnOctets constructor creates an asn octets string node by string of buffer object.

Methods

  • to-buffer -> Buffer (none) β€” The to-buffer method returns a Buffer object as an octet string representation.

πŸ¦‹ AsnBuffer

The AsnBuffer class is the asn object class that provides a generic implementation of an asn structure. The class acts as a simple encoder and decoder with special facilities to retarget the buffer content. multi-talented tbh

Predicate

  • asn-buffer-p

Inheritance

  • AsnNode

Constructors

  • AsnBuffer (none) β€” The AsnBuffer constructor creates a default asn buffer node.
  • AsnBuffer (InputStream|Buffer|Bitset) β€” The AsnBuffer constructor creates an asn buffer node from an input stream, a buffer or a bitset.

Methods

  • reset -> none (none) β€” The reset method reset the buffer.
  • parse -> Boolean (InputStream|Buffer|Bitset) β€” The parse method parse a node represented by an input stream, a buffer or a bitset.
  • node-map -> AsnNode (none) β€” The node-map method returns a node mapping of this buffer.
  • get-content-buffer -> Buffer (none) β€” The get-content-buffer method returns the asn buffer content as a buffer object.

πŸ’œ AsnNull

The AsnNull class is the asn object class that encodes the null primitive. This primitive has a unique encoding. The length is always 0 and there is no content octet. minimalist icon fr

Predicate

  • asn-null-p

Inheritance

  • AsnNode

Constructors

  • AsnNull (none) β€” The AsnNull constructor creates a default asn null node.

πŸ’€ AsnEoc

The AsnEoc class is the asn object class that encodes the eoc or end-of-content primitive. This primitive is almost never used but its encoding is used with the indefinite length encoding. rare specimen energy

Predicate

  • asn-eoc-p

Inheritance

  • AsnNode

Constructors

  • AsnEoc (none) β€” The AsnEoc constructor creates a default asn eoc node.

πŸ“ AsnBoolean

The AsnBoolean class is the asn object class that encodes the boolean primitive. This primitive has a unique encoding with the CER or DER rule, but the BER rule can support any byte value for the true value. BER said "be free"

Predicate

  • asn-boolean-p

Inheritance

  • AsnNode

Constructors

  • AsnBoolean (none) β€” The AsnBoolean constructor creates a default asn boolean node.
  • AsnBoolean (Boolean) β€” The AsnBoolean constructor creates an asn boolean node from a boolean object.

Methods

  • to-boolean -> Boolean (none) β€” The to-boolean method returns a Boolean object as the asn node representation.

🌈 AsnInteger

The AsnInteger class is the asn object class that encodes the integer primitive. This primitive has a unique encoding with the CER or DER rule. All encoding use a signed 2-complement form. math girlies rise up

Predicate

  • asn-integer-p

Inheritance

  • AsnNode

Constructors

  • AsnInteger (none) β€” The AsnInteger constructor creates a default asn integer node.
  • AsnInteger (Integer|Relatif) β€” The AsnInteger constructor creates an asn integer node from an integer or relatif object.

Methods

  • to-relatif -> Relatif (none) β€” The to-relatif method returns a Relatif object as the asn node representation.

⭐ AsnBits

The AsnBits class is the asn object class that encodes the bit string type. This type can be encoded either as a primitive or as constructed at sender's option. In CER form, the primitive form is used when the content length is less than 1000 octets, and the constructed form is used otherwise. The DER form will always use the primitive form. same rules, different string, we love consistency

Predicate

  • asn-bits-p

Inheritance

  • AsnNode

Constructors

  • AsnBits (none) β€” The AsnBits constructor creates a default asn bits node.
  • AsnBits (String|Bitset) β€” The AsnBits constructor creates an asn bits node from a string or a bitset.

Methods

  • to-bits -> Bitset (none) β€” The to-bits method returns a Bitset object as a bit string representation.

🌸 AsnBmps

The AsnBmps class is the asn object class that encodes the asn bmp string primitive also known as the UCS-2 type string. This string is implemented, after conversion, as an octet string. Consequently the rules for encoding in CER and DER modes are applied. converted and serving looks πŸ’…

Predicate

  • asn-bmps-p

Inheritance

  • AsnOctets

Constructors

AsnBmps πŸŽ€

Okay bestie, AsnBmps is giving asn string (BMP) node energy. Here's the whole vibe:

  • AsnBmps (none) β€” The AsnBmps constructor creates a default asn string (BMP) node. ✨
  • AsnBmps (String) β€” The AsnBmps constructor creates an asn string (BMP) node from a string. πŸ’–

Methods πŸ’…

  • to-string -> String (none) β€” The to-string method returns a String object as a node representation. periodt.

AsnIas πŸ¦‹

The AsnIas class is the asn object class that encodes the IA5 string primitive. This string is implemented, after conversion, as an octet string. Consequently, the rules for encoding in CER and DER modes are applied. No cap. πŸ”₯

Predicate

  • asn-ias-p

Inheritance

  • AsnOctets

Constructors

  • AsnIas (none) β€” The AsnIas constructor creates a default asn string (IA5) node.
  • AsnIas (String) β€” The AsnIas constructor creates an asn string (IA5) node from a string.

Methods

  • to-string -> String (none) β€” The to-string method returns a String object as a node representation.

AsnNums πŸ”’

The AsnNums class is the asn object class that encodes the asn numeric string primitive. This string is implemented, after conversion, as an octet string. Consequently, the rules for encoding in CER and DER modes are applied. It's giving numeric realness. ✨

Predicate

  • asn-nums-p

Inheritance

  • AsnOctets

Constructors

  • AsnNums (none) β€” The AsnNums constructor creates a default asn string (NUMERIC) node.
  • AsnNums (String) β€” The AsnNums constructor creates an asn string (NUMERIC) node from a string.

Methods

  • to-string -> String (none) β€” The to-string method returns a String object as a node representation.

AsnPrts πŸ–¨οΈ

The AsnPrts class is the asn object class that encodes the asn printable string primitive. This string is implemented, after conversion, as an octet string. Consequently, the rules for encoding in CER and DER modes are applied. Printable and iconic. πŸ’…

Predicate

  • asn-prts-p

Inheritance

  • AsnOctets

Constructors

  • AsnPrts (none) β€” The AsnPrts constructor creates a default asn string (PRINTABLE) node.
  • AsnPrts (String) β€” The AsnPrts constructor creates an asn string (PRINTABLE) node from a string.

Methods

  • to-string -> String (none) β€” The to-string method returns a String object as a node representation.

AsnUtfs 🌐

The AsnUtfs class is the asn object class that encodes the asn utf string primitive. This string is implemented as an octet string. Consequently, the rules for encoding in CER and DER modes are applied. UTF vibes only. πŸ¦‹

Predicate

  • asn-utfs-p

Inheritance

  • AsnOctets

Constructors

  • AsnUtfs (none) β€” The AsnUtfs constructor creates a default asn string (UNICODE) node.
  • AsnUtfs (String) β€” The AsnUtfs constructor creates an asn string (UNICODE) node from a string.

Methods

  • to-string -> String (none) β€” The to-string method returns a String object as a node representation.

AsnUnvs 🌌

The AsnUnvs class is the asn object class that encodes the universal string primitive also known as the UCS-4 type string. This string is implemented, after conversion, as an octet string. Consequently, the rules for encoding in CER and DER modes are applied. Universal, main character energy. πŸ‘‘

Predicate

  • asn-unvs-p

Inheritance

  • AsnOctets

Constructors

  • AsnUnvs (none) β€” The AsnUnvs constructor creates a default asn string (UNIVERSAL) node.
  • AsnUnvs (String) β€” The AsnUnvs constructor creates an asn string (UNIVERSAL) node from a string.

Methods

  • to-string -> String (none) β€” The to-string method returns a String object as a node representation.

AsnGtm ⏰

The AsnGtm class is the asn object class that encodes the generalized time primitive. This primitive is encoded from its equivalent string representation. Although the constructed mode is authorized, it does not make that much sense to use it. Lowkey pointless but authorized, iykyk. 😭

Predicate

  • asn-gtm-p

Inheritance

  • AsnNode

Constructors

  • AsnGtm (none) β€” The AsnGtm constructor creates a default asn gtm node.
  • AsnGtm (String) β€” The AsnGtm constructor creates an asn gtm node from a string.

Methods

  • utc-p -> Boolean (none) β€” The utc-p predicate returns true if the time is expressed in UTC mode.
  • to-time -> Integer (none) β€” The to-time method returns a time representation of this asn node.
  • to-string -> String (none) β€” The to-string method returns a string representation of this asn node.

AsnUtc πŸ•°οΈ

The AsnUtc class is the asn object class that encodes the utc time primitive. This primitive is encoded from its equivalent string representation. Although the constructed mode is authorized, it does not make that much sense to use it. Same energy as AsnGtm, just UTC-coded. ✨

Predicate

  • asn-utc-p

Inheritance

  • AsnNode

Constructors

  • AsnUtc (none) β€” The AsnUtc constructor creates a default asn utc node.
  • AsnUtc (String) β€” The AsnUtc constructor creates an asn utc node from a string.

Methods

  • utc-p -> Boolean (none) β€” The utc-p predicate returns true if the time is expressed in UTC mode.
  • to-time -> Integer (none) β€” The to-time method returns a time representation of this asn node.
  • to-string -> String (none) β€” The to-string method returns a string representation of this asn node.

AsnSequence 🧚

The AsnSequence class is the asn object class that encodes the sequence constructed type. The order of elements is preserved in the encoding of the sequence. Order matters, bestie. πŸ’…

Predicate

  • asn-sequence-p

Inheritance

  • AsnNode

Constructors

  • AsnSequence (none) β€” The AsnSequence constructor creates an empty asn sequence node.

Methods

  • node-length -> Integer (none) β€” The node-length method returns the number of nodes in the sequence.
  • node-add -> none (AsnNode) β€” The node-add method adds a node to the sequence.
  • node-get -> AsnNode (Integer) β€” The node-get method returns an asn node by index.

AsnSet πŸŽ€

The AsnSet class is the asn object class that encodes the set constructed type. The order of elements is not important in a set. No order, no stress. ✨

Predicate

  • asn-set-p

Inheritance

  • AsnNode

Constructors

  • AsnSet (none) β€” The AsnSet constructor creates an empty asn set node.

Methods

  • node-length -> Integer (none) β€” The node-length method returns the number of nodes in the set.
  • node-add -> none (AsnNode) β€” The node-add method adds a node to the set.
  • node-get -> AsnNode (Integer) β€” The node-get method returns an asn node by index.

Oid 🌈

The Oid class is a base class that represents the X500 object identifier which is used in the ASN.1 encoding and in the X509 standard. An oid is simply represented by a vector of subidentifiers. Iconic X500 realness. πŸ‘‘

Predicate

  • oid-p

Inheritance

  • Object

Constructors

  • Oid (Integer|...) β€” The Oid constructor creates an oid from a sequence of integers.

Methods

  • reset -> none (none) β€” The reset method resets the oid object to its null empty state.
  • length -> Integer (none) β€” The length method returns the length of the oid.
  • add -> none (Integer|...) β€” The add method adds one or more sub-indentifiers to the oid.
  • get -> Integer (Integer) β€” The get method returns an oid sub-identifier by index.
  • format -> String (none) β€” The format method returns a string representation of the oid.

AsnOid πŸ”₯

The AsnOid class is the asn object class that encodes the object identifier primitive. This primitive has a unique encoding with the CER or DER rule. The oid is built as a vector of subidentifiers (sid). Each sid is represented as an octa (64 bits) value. Unique encoding, no cap. πŸ’€

Predicate

  • asn-oid-p

Inheritance

  • AsnNode

Constructors

  • AsnOid (Integer|...) β€” The AsnOid constructor creates an asn oid from a sequence of sid.

Methods

  • sid-length -> Integer (none) β€” The length method returns the length of the oid.
  • sid-add -> none (Integer) β€” The sid-add method adds a sid the oid object.
  • sid-get -> Integer (Integer) β€” The sid-get method returns a sid by oid index.
  • get-oid -> Oid (none) β€” The get-oid method returns an oid object as the asn oid representation.

AsnRoid πŸŒ€

The AsnRoid class is the asn object class that encodes the object relative identifier primitive. This primitive has a unique encoding with the CER or DER rule. The oid is built as a vector of subidentifiers (sid). Each sid is represented as an octa (64 bits) value. The difference with the oid object is to be found in the encoding of the first 2 sid. First two sids hit different. 😭

Predicate

  • asn-roid-p

Inheritance

  • AsnNode

Constructors

  • AsnRoid (Integer|...) β€” The AsnRoid constructor creates an asn roid from a sequence of sid.

Methods

  • sid-length -> Integer (none) β€” The length method returns the length of the oid.
  • sid-add -> none (Integer) β€” The sid-add method adds a sid the oid object.
  • sid-get -> Integer (Integer) β€” The sid-get method returns a sid by oid index.
  • get-oid -> Oid (none) β€” The get-oid method returns an oid object as the asn oid representation.

Functions πŸ› οΈ

  • asn-random-bits -> none (Integer) β€” The exit function creates a random asn bit string. The argument is the number of bits in the random string. (Yes, the page calls it the exit function β€” we're keeping that typo for the culture. πŸ’€)
  • asn-random-octets -> none (Integer) β€” The exit function creates a random asn octet string. The integer argument is the number of octets in the string. (Again, exit function, iconic. ✨)

Okay bestie, that's the whole itu(3) part 2. Source/version: AFNIX Module / AFNIX / itu(3), plus the date stamp in the footer. Stay iconic, keep your ASN.1 encoding slay, and remember: CER/DER rules are not a suggestion. πŸ’…βœ¨πŸ¦‹

πŸ“¦ where this page comes from