Expand description
X.500 distinguished names on tc_asn1, as used for the subject and
issuer of X.509 certificates.
A Name is a sequence of RelativeDistinguishedNames, each a set of
AttributeTypeAndValue pairs whose values are mostly
DirectoryStrings; AttributeType has the OIDs that occur in names,
and Attribute carries a set of values, as in certificate requests.
Every type decodes any BER and encodes under BER, CER or DER through the
tc_asn1 traits. A Name also parses from and prints as RFC 4514 text,
and compares strictly with == or with the relaxed matching of RFC 5280
§7.1 through equivalent.
use tc_asn1::{Decode, DecodingOptions, Encode, EncodingOptions};
use tc_asn1_x500::Name;
let name: Name = "CN=Alice,O=Example,C=TW".parse()?;
let der = name.encode_to_vec(&EncodingOptions::DER)?;
let (_, decoded) = Name::decode(&der, &DecodingOptions::default())?;
assert_eq!(decoded.to_string(), "CN=Alice,O=Example,C=TW");
assert!(decoded.equivalent(&"cn=alice, o=EXAMPLE, c=TW".parse()?));Structs§
- Attribute
- An attribute OID and a non-empty set of values.
- Attribute
Type - The known attribute types, as
NamedOidconstants with lookups. - Attribute
Type AndValue - An attribute type OID with its value.
- Name
- A distinguished name as a sequence of RDNs, root first. Parses from and prints as its RFC 4514 string form.
- Relative
Distinguished Name - A non-empty set of attributes making up one level of a name.
Enums§
- Attribute
Value - The value of an attribute, classified by its identifier.
- Directory
String - The string CHOICE used for most
Nameattribute values. Never empty when built withnew; may be empty when decoded.