Skip to main content

Crate tsumiki_asn1

Crate tsumiki_asn1 

Source
Expand description

§tsumiki-asn1

ASN.1 (Abstract Syntax Notation One) data structure representation.

This crate implements ASN.1 types as defined in ITU-T X.680.

§Supported Types

  • Primitive types: INTEGER, BOOLEAN, NULL, OCTET STRING, BIT STRING
  • String types: UTF8String, PrintableString, IA5String, BMPString
  • Time types: UTCTime, GeneralizedTime
  • Structured types: SEQUENCE, SET
  • Object identifiers: OBJECT IDENTIFIER
  • Context-specific types

§Example

use tsumiki::decoder::Decoder;
use tsumiki_der::Der;
use tsumiki_asn1::ASN1Object;

// DER bytes for SEQUENCE { INTEGER 42 }
let bytes = vec![0x30, 0x03, 0x02, 0x01, 0x2a];

// Parse DER to ASN.1
let der: Der = bytes.decode()?;
let asn1: ASN1Object = der.decode()?;

assert_eq!(asn1.elements().len(), 1);

Modules§

error
Error types for ASN.1 parsing and encoding.

Structs§

ASN1Object
ASN.1 object representation.
BMPString
BMPString (Basic Multilingual Plane String)
BitString
ASN.1 BIT STRING.
Integer
ASN.1 INTEGER type.
ObjectIdentifier
ASN.1 OBJECT IDENTIFIER (OID).
OctetString
ASN.1 OCTET STRING.

Enums§

Element
ASN.1 element types.

Traits§

AsOid
Trait for types that can be converted to an ObjectIdentifier.