Module x509_rdn_sequence

Convenience functions for creating ':rdnSquence' tuples, as defined in 'public_key' as the 'issuer_name()' type, and representing the X.509 RDNSequence type.

Description

Convenience functions for creating ':rdnSquence' tuples, as defined in 'public_key' as the 'issuer_name()' type, and representing the X.509 RDNSequence type. RDNSequences are primarily used for the Subject and Issuer fields of certificates, as well as the Subject field of CSRs.

Note that this module implements a commonly used subset of RDNSequence values. It supports only a single attribute type/value pair for each element in the sequence, and it implements the attribute types specified in RFC5280, section 4.1.2.4, with a few extensions from LDAP:

* countryName (C) * organizationName (O) * organizationalUnitName (OU) * dnQualifier * stateOrProvinceName (ST) * commonName (CN) * serialNumber * localityName (L) * title * name * surname (SN) * givenName (GN) * initials * pseudonym * generationQualifier * domainComponent (DC) * emailAddress (E)

This module encodes values as UTF8String where possible, or else PrintableString/IA5String where required.

Data Types

attr_list()

attr_list() = [attribute()]

attr_raw_value()

attr_raw_value() = string() | {utf8String, binary()}

attribute()

attribute() = {binary() | atom(), binary()} | {public_key:oid(), attr_raw_value()}

Function Index

from_attr_list/1Creates a new 'rdnSquence' tuple from an attribute list.
from_attr_list/2Creates a new 'rdnSquence' tuple from an attribute list.
from_string/1Creates a new 'rdnSquence' tuple from a string.
from_string/2Creates a new 'rdnSquence' tuple from a string.
get_attr/2Extracts the values for the specified attributes from a 'rdnSquence' tuple.
to_string/1Converts an 'rdnSquence' tuple to a human readable string.

Function Details

from_attr_list/1

from_attr_list(List::attr_list()) -> public_key:issuer_name()

Creates a new 'rdnSquence' tuple from an attribute list. Equivalent to 'from_attr_list(List, plain)'

from_attr_list/2

from_attr_list(List::attr_list(), X2::plain | otp) -> public_key:issuer_name()

Creates a new 'rdnSquence' tuple from an attribute list.

The second parameter selects the output format:

* 'plain' - for use in 'Certificate' and 'CertificationRequest' records * 'otp' - for use in 'OTPCertificate' records

from_string/1

from_string(String::string()) -> public_key:issuer_name()

Creates a new 'rdnSquence' tuple from a string. Equivalent to 'from_string(String, plain)'

from_string/2

from_string(More::string(), Type::plain | otp) -> public_key:issuer_name()

Creates a new 'rdnSquence' tuple from a string.

The value can be specified in one of the following formats:

* A string specifying the attributes in hierarchical format, e.g. "/C=US/ST=NT/L=Springfield/O=ACME Inc." * A string specifying a comma-separated list of attributes, e.g. "C=US, ST=NT, L=Springfield, O=ACME Inc."

Note that the string parser does not (currently) recognize escape characters: separator characters ('/' and ',', respectively) are not allowed in attribute values.

The second parameter selects the output format:

* 'plain' - for use in 'Certificate' and 'CertificationRequest' records * 'otp' - for use in 'OTPCertificate' records

Raises an error when the given value cannot be parsed, contains unsupported attribute types or when values cannot be coerced into the expected ASN.1 type.

get_attr/2

get_attr(RDNSequence::public_key:issuer_name(), OID::binary() | atom() | public_key:oid()) -> [string()]

Extracts the values for the specified attributes from a 'rdnSquence' tuple.

The attribute type may be specified as an attribute name (long or short form, as a string, or long from as an atom) or an OID tuple. Refer to the documentation at the top of this module for a list of supported attributes.

Since an attribute may appear more than once in an RDN sequence the result is a list of values.

to_string/1

to_string(X1::public_key:issuer_name()) -> string()

Converts an 'rdnSquence' tuple to a human readable string


Generated by EDoc