Expand description
§X.690 Encoding Rules Library
This library provides comprehensive support for X.690 encoding rules, which define how ASN.1 (Abstract Syntax Notation One) data structures are encoded for transmission and storage.
§Overview
X.690 defines several encoding rules:
- BER (Basic Encoding Rules): The most flexible encoding, supporting both definite and indefinite lengths
- CER (Canonical Encoding Rules): A restricted form of BER that produces canonical encodings
- DER (Distinguished Encoding Rules): A restricted form of BER that produces unique encodings
This library focuses on BER encoding and decoding, providing a complete implementation of the X.690 specification.
§Key Features
- Complete BER encoding and decoding support
- Support for all ASN.1 universal types
- Efficient memory management with zero-copy operations where possible
- Comprehensive error handling with detailed error information
- Support for both definite and indefinite length encoding
- Tag and length encoding/decoding utilities
Re-exports§
Modules§
- ber
- This module implements the Basic Encoding Rules (BER) for X.690.
- codec
X690Codec
trait, which is implemented by all X.690 codecs- der
- This module implements the Basic Encoding Rules (DER) for X.690.
- parsing
- Functionality for parsing structured types, such as
SEQUENCE
andSET
Structs§
- Deconstruction
Iterator - An iterator that iterates over the primitive content octets of the constituent elements of this element, recursively.
- X690
Element - Represents a complete X.690 encoded element with tag and value
Enums§
- X690
Length - Represents the length of an X.690 encoded element
- X690
Value - Represents the value content of an X.690 encoded element
Constants§
- X690_
REAL_ BASE10 - Base encoding constant for base-10
REAL
values - X690_
REAL_ BASE_ 2 - Base encoding constant for base-2
REAL
values - X690_
REAL_ BASE_ 8 - Base encoding constant for base-8
REAL
values - X690_
REAL_ BASE_ 16 - Base encoding constant for base-16
REAL
values - X690_
REAL_ BASE_ MASK - Bit mask for extracting the base bits from
REAL
encoding - X690_
REAL_ BASE_ RESERVED - Reserved base encoding constant for
REAL
values - X690_
REAL_ BINARY - Base encoding constant for binary
REAL
values - X690_
REAL_ BINARY_ SCALING_ MASK - Bit mask for extracting binary scaling factor from
REAL
encoding - X690_
REAL_ EXPONENT_ FORMAT_ 1_ OCTET - Exponent format constant for 1-octet exponent
- X690_
REAL_ EXPONENT_ FORMAT_ 2_ OCTET - Exponent format constant for 2-octet exponent
- X690_
REAL_ EXPONENT_ FORMAT_ 3_ OCTET - Exponent format constant for 3-octet exponent
- X690_
REAL_ EXPONENT_ FORMAT_ MASK - Bit mask for extracting exponent format from
REAL
encoding - X690_
REAL_ EXPONENT_ FORMAT_ VAR_ OCTET - Exponent format constant for variable-length exponent
- X690_
REAL_ NEGATIVE - Sign bit constant for negative
REAL
values - X690_
REAL_ NR1 - ISO 6093 NR1 format constant for
REAL
encoding - X690_
REAL_ NR2 - ISO 6093 NR2 format constant for
REAL
encoding - X690_
REAL_ NR3 - ISO 6093 NR3 format constant for
REAL
encoding - X690_
REAL_ POSITIVE - Sign bit constant for positive
REAL
values - X690_
REAL_ SIGN_ MASK - Bit mask for extracting the sign bit from
REAL
encoding - X690_
REAL_ SPECIAL - Flag indicating a special
REAL
value - X690_
SPECIAL_ REAL_ MINUS_ INFINITY - Special
REAL
value constant for negative infinity - X690_
SPECIAL_ REAL_ MINUS_ ZERO - Special
REAL
value constant for negative zero - X690_
SPECIAL_ REAL_ NOT_ A_ NUMBER - Special
REAL
value constant for Not-a-Number (NaN) - X690_
SPECIAL_ REAL_ PLUS_ INFINITY - Special
REAL
value constant for positive infinity - X690_
TAG_ CLASS_ APPLICATION - Tag class bits for
APPLICATION
tags in X.690 encoding - X690_
TAG_ CLASS_ CONTEXT - Tag class bits for
CONTEXT
tags in X.690 encoding - X690_
TAG_ CLASS_ PRIVATE - Tag class bits for
PRIVATE
tags in X.690 encoding - X690_
TAG_ CLASS_ UNIVERSAL - Tag class bits for
UNIVERSAL
tags in X.690 encoding - _EAL_
FOR_ EXTERNAL - The Extended Attribute List (EAL) for the X.690-specific encoding of
an
EXTERNAL
value as described in ITU Recommendation X.690, Section 8.18. It is empty, so this is basically just a formality. - _RCT
L1_ FOR_ EXTERNAL - The Root Component Type List (RCTL) #1 for the X.690-specific encoding of
an
EXTERNAL
value as described in ITU Recommendation X.690, Section 8.18. - _RCT
L2_ FOR_ EXTERNAL - The Root Component Type List (RCTL) #2 for the X.690-specific encoding of
an
EXTERNAL
value as described in ITU Recommendation X.690, Section 8.18. It is empty, so this is basically just a formality.
Traits§
- RelateTLV
- A trait for relating an X.690-encoded element to something
Functions§
- deconstruct
- Deconstruct an X.690-encoded element that could be primitively-constructed
- get_
written_ x690_ length_ length - Calculates the number of bytes needed to encode a length value
- get_
written_ x690_ tag_ length - Calculates the number of bytes needed to encode a tag number
- get_
x690_ tag_ and_ length_ length - Calculates the total length of tag and length bytes in an X.690 encoding
- primitive
- Get the primitive content octets of an X.690 element, or an error
- x690_
decode_ tag - Decodes an X.690 tag from a byte slice
- x690_
encode_ character_ string_ components - Encode the components of a
CharacterString
value as X.690-encoded elements - x690_
encode_ context_ switching_ identification - Encode the
identification
field of a context-switching type - x690_
encode_ embedded_ pdv_ components - Encode the components of an
EMBEDDED PDV
value as X.690-encoded elements - x690_
encode_ external_ components - Encode the components of an
EXTERNAL
value as X.690-encoded elements - x690_
read_ boolean_ value - Read a
BOOLEAN
value from an X.690-encoded element’s content octets - x690_
read_ date_ time_ value - Read a
DATE-TIME
value from an X.690-encoded element’s content octets - x690_
read_ date_ value - Read a
DATE
value from an X.690-encoded element’s content octets - x690_
read_ duration_ value - Read a
DURATION
value from an X.690-encoded element’s content octets - x690_
read_ enum_ value - Read an
ENUMERATED
value from an X.690-encoded element’s content octets - x690_
read_ i64_ value - Read an
i64
value from an X.690-encoded element’s content octets - x690_
read_ integer_ value - Read an
INTEGER
value from an X.690-encoded element’s content octets - x690_
read_ object_ identifier_ value - Read an
OBJECT IDENTIFIER
value from an X.690-encoded element’s content octets - x690_
read_ relative_ oid_ value - Read a
RELATIVE-OID
value from an X.690-encoded element’s content octets - x690_
read_ time_ of_ day_ value - Read a
TIME-OF-DAY
value from an X.690-encoded element’s content octets - x690_
write_ bit_ string_ value - Writes a
BIT STRING
value in X.690 format - x690_
write_ bmp_ string_ value - Write a
BMPString
value as an X.690-encoded element, returning the number of bytes written - x690_
write_ boolean_ value - Writes a
BOOLEAN
value in X.690 format - x690_
write_ character_ string_ value - Write a
CharacterString
value as an X.690-encoded element, returning the number of bytes written - x690_
write_ date_ time_ value - Write a
DATE-TIME
value as an X.690-encoded element, returning the number of bytes written - x690_
write_ date_ value - Write a
DATE
value as an X.690-encoded element, returning the number of bytes written - x690_
write_ duration_ value - Write a
DURATION
value as an X.690-encoded element, returning the number of bytes written - x690_
write_ embedded_ pdv_ value - Write an
EMBEDDED PDV
value as an X.690-encoded element - x690_
write_ enum_ value - Writes an
ENUMERATED
value in X.690 format - x690_
write_ external_ value - Write an
EXTERNAL
value as an X.690-encoded element - x690_
write_ generalized_ time_ value - Write a
GeneralizedTime
value as an X.690-encoded element, returning the number of bytes written - x690_
write_ i64_ value - Writes an i64 value in X.690
INTEGER
format - x690_
write_ integer_ value - Writes an
INTEGER
value in X.690 format - x690_
write_ length - Writes an X.690 length to a writer
- x690_
write_ object_ descriptor_ value - Writes an
ObjectDescriptor
value in X.690 format - x690_
write_ object_ identifier_ value - Writes an
OBJECT IDENTIFIER
value in X.690 format - x690_
write_ octet_ string_ value - Writes an
OCTET STRING
value in X.690 format - x690_
write_ real_ value - Write a
REAL
value as an X.690-encoded element - x690_
write_ relative_ oid_ value - Write a
RELATIVE-OID
value as an X.690-encoded element, returning the number of bytes written - x690_
write_ string_ value - Write a string value as an X.690-encoded element, returning the number of bytes written
- x690_
write_ tag - Writes an X.690 tag to a writer
- x690_
write_ time_ of_ day_ value - Write a
TIME-OF-DAY
value as an X.690-encoded element, returning the number of bytes written - x690_
write_ time_ value - Write a
TIME
value as an X.690-encoded element, returning the number of bytes written - x690_
write_ tlv - Write an X.690-encoded element to a writable stream, returning the number of bytes written
- x690_
write_ universal_ string_ value - Write a
UniversalString
value as an X.690-encoded element, returning the number of bytes written - x690_
write_ utc_ time_ value - Write a
UTCTime
value as an X.690-encoded element, returning the number of bytes written - x690_
write_ utf8_ string_ value - Write a
UTF8String
value as an X.690-encoded element, returning the number of bytes written