Module string

Source
Expand description

BER encoding for various strings types.

This module provides type that match the various string encodings provided by ASN.1 and BER.

There are two types of strings for binary data. OctetStrings contain a unrestricted sequence of octets while BitStrings contain a sequence of bits that does not need to be of a length divisible by eight.

In addition, there are a number of so-called restricted character strings that each conain a sequence of characters according to a pre-defined character set. ASN.1 defines quite a few of those of which the crate currently only implements a subset that is commonly in use. Specifically:

  • Ia5String contains ASCII characters only (IA5 is an alternative name for ASCII),
  • NumericString contains only decimals digits and spaces,
  • PrintableString contains a subset of ASCII characters including letters, digits, and a few symbols,
  • Utf8String contains a sequence of Unicode code points encoded as octets through UTF-8.

All of these are implemented atop a generic RestrictedString by providing an implementation for the CharSet trait.

Structs§

BitString
A bit string value.
BitStringIter
An iterator over the octets in the bit string.
CharSetError
An illegal value was encountered during character set conversion.
OctetString
An octet string value.
OctetStringEncoder
A value encoder for an octet string.
OctetStringIter
An iterator over the segments of an octet string.
OctetStringOctets
An iterator over the octets in an octet string.
OctetStringSource
A decode source atop an octet string.
RestrictedString
A generic restricted character string.
RestrictedStringChars
An iterator over the characters in a restricted character string.
WrappingOctetStringEncoder
A value encoder that wraps the encoded inner values into an octet string.

Traits§

CharSet
The character set of a restricted character string type.

Type Aliases§

Ia5String
A restricted character string containing ASCII characters.
NumericString
A restricted character string containing only digits and spaces.
PrintableString
A restricted character string allowing a subset of ASCII characters.
Utf8String
A restricted character string containing UTF-8 encoded characters.