X500Name

Note: As of 1.4, the class, javax.security.auth.x500.X500Principal, should be used when parsing, generating, and comparing X.500 DNs. This class contains other useful methods for checking name constraints and retrieving DNs by keyword.

<p> X.500 names are used to identify entities, such as those which are identified by X.509 certificates. They are world-wide, hierarchical, and descriptive. Entities can be identified by attributes, and in some systems can be searched for according to those attributes. <p> The ASN.1 for this is: <pre> GeneralName ::= CHOICE { .... directoryName [4] Name, .... Name ::= CHOICE { RDNSequence }

RDNSequence ::= SEQUENCE OF RelativeDistinguishedName

RelativeDistinguishedName ::= SET OF AttributeTypeAndValue

AttributeTypeAndValue ::= SEQUENCE { type AttributeType, value AttributeValue }

AttributeType ::= OBJECT IDENTIFIER

AttributeValue ::= ANY DEFINED BY AttributeType .... DirectoryString ::= CHOICE { teletexString TeletexString (SIZE (1..MAX)), printableString PrintableString (SIZE (1..MAX)), universalString UniversalString (SIZE (1..MAX)), utf8String UTF8String (SIZE (1.. MAX)), bmpString BMPString (SIZE (1..MAX)) } </pre> <p> This specification requires only a subset of the name comparison functionality specified in the X.500 series of specifications. The requirements for conforming implementations are as follows: <ol TYPE=a> <li>attribute values encoded in different types (e.g., PrintableString and BMPString) may be assumed to represent different strings; <p> <li>attribute values in types other than PrintableString are case sensitive (this permits matching of attribute values as binary objects); <p> <li>attribute values in PrintableString are not case sensitive (e.g., "Marianne Swanson" is the same as "MARIANNE SWANSON"); and <p> <li>attribute values in PrintableString are compared after removing leading and trailing white space and converting internal substrings of one or more consecutive white space characters to a single space. </ol> <p> These name comparison rules permit a certificate user to validate certificates issued using languages or encodings unfamiliar to the certificate user. <p> In addition, implementations of this specification MAY use these comparison rules to process unfamiliar attribute types for name chaining. This allows implementations to process certificates with unfamiliar attributes in the issuer name. <p> Note that the comparison rules defined in the X.500 series of specifications indicate that the character sets used to encode data in distinguished names are irrelevant. The characters themselves are compared without regard to encoding. Implementations of the profile are permitted to use the comparison algorithm defined in the X.500 series. Such an implementation will recognize a superset of name matches recognized by the algorithm specified above. <p> Note that instances of this class are immutable.

@author David Brownell @author Amit Kapoor @author Hemma Prafullchandra @see GeneralName @see GeneralNames @see GeneralNameInterface

Constructors

this
this(string dname)

Constructs a name from a conventionally formatted string, such as "CN=Dave, OU=JavaSoft, O=Sun Microsystems, C=US". (RFC 1779, 2253, or 4514 style).

this
this(string dname, Map!(string, string) keywordMap)

Constructs a name from a conventionally formatted string, such as "CN=Dave, OU=JavaSoft, O=Sun Microsystems, C=US". (RFC 1779, 2253, or 4514 style).

this
this(string dname, string format)

Constructs a name from a string formatted according to format. Currently, the formats DEFAULT and RFC2253 are supported. DEFAULT is the default format used by the X500Name(string) constructor. RFC2253 is the format strictly according to RFC2253 without extensions.

this
this(string commonName, string organizationUnit, string organizationName, string country)

Constructs a name from fields common in enterprise application environments.

this
this(string commonName, string organizationUnit, string organizationName, string localityName, string stateName, string country)

Constructs a name from fields common in Internet application environments.

this
this(DerValue value)

Constructs a name from an ASN.1 encoded value. The encoding of the name in the stream uses DER (a BER/1 subset).

this
this(byte[] name)

Constructs a name from an ASN.1 encoded byte array.

Members

Functions

asX500Principal
X500Principal asX500Principal()

Get an X500Principal backed by this X500Name.

avaSize
int avaSize()

Return the total number of AVAs contained in all the RDNs of this X500Name.

constrains
int constrains(GeneralNameInterface inputName)

Return constraint type:<ul> <li>NAME_DIFF_TYPE = -1: input name is different type from this name (i.e. does not constrain) <li>NAME_MATCH = 0: input name matches this name <li>NAME_NARROWS = 1: input name narrows this name <li>NAME_WIDENS = 2: input name widens this name <li>NAME_SAME_TYPE = 3: input name does not match or narrow this name, & but is same type </ul>. These results are used in checking NameConstraints during certification path verification.

encode
void encode(DerOutputStream ot)

Encodes the name in DER-encoded form.

getEncoded
byte[] getEncoded()

Gets the name in DER-encoded form.

getEncodedInternal
byte[] getEncodedInternal()

Returned the encoding as an uncloned byte array. Callers must guarantee that they neither modify it not expose it to untrusted code.

getName
string getName()

Returns the value of toString(). This call is needed to implement the java.security.Principal interface.

getRFC1779Name
string getRFC1779Name()

Returns a string form of the X.500 distinguished name using the algorithm defined in RFC 1779. Only standard attribute type keywords defined in RFC 1779 are emitted.

getRFC1779Name
string getRFC1779Name(Map!(string, string) oidMap)

Returns a string form of the X.500 distinguished name using the algorithm defined in RFC 1779. Attribute type keywords defined in RFC 1779 are emitted, as well as additional keywords contained in the OID/keyword map.

getRFC2253CanonicalName
string getRFC2253CanonicalName()
Undocumented in source. Be warned that the author may not have intended to support it.
getRFC2253Name
string getRFC2253Name()

Returns a string form of the X.500 distinguished name using the algorithm defined in RFC 2253. Only standard attribute type keywords defined in RFC 2253 are emitted.

getRFC2253Name
string getRFC2253Name(Map!(string, string) oidMap)

Returns a string form of the X.500 distinguished name using the algorithm defined in RFC 2253. Attribute type keywords defined in RFC 2253 are emitted, as well as additional keywords contained in the OID/keyword map.

getType
int getType()

Return type of GeneralName.

isEmpty
bool isEmpty()

Return whether this X500Name is empty. An X500Name is not empty if it has at least one RDN containing at least one AVA.

opEquals
bool opEquals(Object obj)

Compares this name with another, for equality.

size
int size()

Return the number of RDNs in this X500Name.

subtreeDepth
int subtreeDepth()

Return subtree depth of this name for purposes of determining NameConstraints minimum and maximum bounds and for calculating path lengths in name subtrees.

toHash
size_t toHash()

Calculates a hash code value for the object. Objects which are equal will also have the same hashcode.

toString
string toString()

Returns a string form of the X.500 distinguished name. The format of the string is from RFC 1779. The returned string may contain non-standardised keywords for more readability (keywords from RFCs 1779, 2253, and 3280).

Static functions

countQuotes
int countQuotes(string string, int from, int to)
Undocumented in source. Be warned that the author may not have intended to support it.

Inherited Members

From GeneralNameInterface

NAME_ANY
enum int NAME_ANY;

The list of names supported.

NAME_RFC822
enum int NAME_RFC822;
Undocumented in source.
NAME_DNS
enum int NAME_DNS;
Undocumented in source.
NAME_X400
enum int NAME_X400;
Undocumented in source.
NAME_DIRECTORY
enum int NAME_DIRECTORY;
Undocumented in source.
NAME_EDI
enum int NAME_EDI;
Undocumented in source.
NAME_URI
enum int NAME_URI;
Undocumented in source.
NAME_IP
enum int NAME_IP;
Undocumented in source.
NAME_OID
enum int NAME_OID;
Undocumented in source.
NAME_DIFF_TYPE
enum int NAME_DIFF_TYPE;

The list of constraint results.

NAME_MATCH
enum int NAME_MATCH;
Undocumented in source.
NAME_NARROWS
enum int NAME_NARROWS;
Undocumented in source.
NAME_WIDENS
enum int NAME_WIDENS;
Undocumented in source.
NAME_SAME_TYPE
enum int NAME_SAME_TYPE;
Undocumented in source.
getType
int getType()

Return the type of the general name, as defined above.

encode
void encode(DerOutputStream ot)

Encode the name to the specified DerOutputStream.

constrains
int constrains(GeneralNameInterface inputName)

Return type of constraint inputName places on this name:<ul> <li>NAME_DIFF_TYPE = -1: input name is different type from name (i.e. does not constrain). <li>NAME_MATCH = 0: input name matches name. <li>NAME_NARROWS = 1: input name narrows name (is lower in the naming subtree) <li>NAME_WIDENS = 2: input name widens name (is higher in the naming subtree) <li>NAME_SAME_TYPE = 3: input name does not match or narrow name, but is same type. </ul>. These results are used in checking NameConstraints during certification path verification.

subtreeDepth
int subtreeDepth()

Return subtree depth of this name for purposes of determining NameConstraints minimum and maximum bounds and for calculating path lengths in name subtrees.

From Principal

getName
string getName()

Returns the name of this principal.

Meta