java.lang.Object | |
↳ | sun.security.x509.X500Name |
Note: As of 1.4, the public 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.
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.
The ASN.1 for this is:
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)) }
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:
These name comparison rules permit a certificate user to validate certificates issued using languages or encodings unfamiliar to the certificate user.
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.
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.
Note that instances of this class are immutable.
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
DNQUALIFIER_OID | |||||||||||
DOMAIN_COMPONENT_OID | |||||||||||
GENERATIONQUALIFIER_OID | |||||||||||
GIVENNAME_OID | |||||||||||
INITIALS_OID | |||||||||||
SERIALNUMBER_OID | |||||||||||
SURNAME_OID | |||||||||||
commonName_oid | |||||||||||
countryName_oid | |||||||||||
ipAddress_oid | |||||||||||
localityName_oid | |||||||||||
orgName_oid | |||||||||||
orgUnitName_oid | |||||||||||
stateName_oid | |||||||||||
streetAddress_oid | |||||||||||
title_oid | |||||||||||
userid_oid |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Constructs a name from a conventionally formatted string, such
as "CN=Dave, OU=JavaSoft, O=Sun Microsystems, C=US".
| |||||||||||
Constructs a name from a conventionally formatted string, such
as "CN=Dave, OU=JavaSoft, O=Sun Microsystems, C=US".
| |||||||||||
Constructs a name from a string formatted according to format.
| |||||||||||
Constructs a name from fields common in enterprise application
environments.
| |||||||||||
Constructs a name from fields common in Internet application
environments.
| |||||||||||
Constructs a name from an array of relative distinguished names
| |||||||||||
Constructs a name from an ASN.1 encoded value.
| |||||||||||
Constructs a name from an ASN.1 encoded input stream.
| |||||||||||
Constructs a name from an ASN.1 encoded byte array.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Return an immutable List of the the AVAs contained in all the
RDNs of this X500Name.
| |||||||||||
Get the X500Name contained in the given X500Principal.
| |||||||||||
Get an X500Principal backed by this X500Name.
| |||||||||||
Return the total number of AVAs contained in all the RDNs of
this X500Name.
| |||||||||||
Return lowest common ancestor of this name and other name
| |||||||||||
Return constraint type:
| |||||||||||
This method is deprecated.
Use encode() instead
| |||||||||||
Encodes the name in DER-encoded form.
| |||||||||||
Compares this name with another, for equality.
| |||||||||||
Find the most specific ("last") attribute of the given
type.
| |||||||||||
Returns a "Common Name" component.
| |||||||||||
Returns a "Country" name component.
| |||||||||||
Returns a "DN Qualifier" name component.
| |||||||||||
Returns a "Domain" name component.
| |||||||||||
Gets the name in DER-encoded form.
| |||||||||||
Returned the encoding as an uncloned byte array.
| |||||||||||
Returns a "Generation Qualifier" name component.
| |||||||||||
Returns a "Given Name" name component.
| |||||||||||
Returns an "IP address" name component.
| |||||||||||
Returns an "Initials" name component.
| |||||||||||
Returns a "Locality" name component.
| |||||||||||
Returns the value of toString().
| |||||||||||
Returns an "Organization" name component.
| |||||||||||
Returns an "Organizational Unit" name component.
| |||||||||||
Returns a string form of the X.500 distinguished name
using the algorithm defined in RFC 1779.
| |||||||||||
Returns a string form of the X.500 distinguished name
using the algorithm defined in RFC 1779.
| |||||||||||
Returns a string form of the X.500 distinguished name
using the algorithm defined in RFC 2253.
| |||||||||||
Returns a string form of the X.500 distinguished name
using the algorithm defined in RFC 2253.
| |||||||||||
Returns a "State" name component.
| |||||||||||
Returns a "Surname" name component.
| |||||||||||
Return type of GeneralName.
| |||||||||||
Calculates a hash code value for the object.
| |||||||||||
Return whether this X500Name is empty.
| |||||||||||
Return an immutable List of all RDNs in this X500Name.
| |||||||||||
Return the number of RDNs in this X500Name.
| |||||||||||
Return subtree depth of this name for purposes of determining
NameConstraints minimum and maximum bounds and for calculating
path lengths in name subtrees.
| |||||||||||
Returns a string form of the X.500 distinguished name.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() |
Constructs a name from a conventionally formatted string, such as "CN=Dave, OU=JavaSoft, O=Sun Microsystems, C=US". (RFC 1779 or RFC 2253 style).
IOException |
---|
Constructs a name from a conventionally formatted string, such as "CN=Dave, OU=JavaSoft, O=Sun Microsystems, C=US". (RFC 1779 or RFC 2253 style).
keywordMap | an additional keyword/OID map |
---|
IOException |
---|
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 format strictly according to RFC2253 without extensions.
IOException |
---|
Constructs a name from fields common in enterprise application environments.
NOTE: The behaviour when any of these strings contain characters outside the ASCII range is unspecified in currently relevant standards.
commonName | common name of a person, e.g. "Vivette Davis" |
---|---|
organizationUnit | small organization name, e.g. "Purchasing" |
organizationName | large organization name, e.g. "Onizuka, Inc." |
country | two letter country code, e.g. "CH" |
IOException |
---|
Constructs a name from fields common in Internet application environments.
NOTE: The behaviour when any of these strings contain characters outside the ASCII range is unspecified in currently relevant standards.
commonName | common name of a person, e.g. "Vivette Davis" |
---|---|
organizationUnit | small organization name, e.g. "Purchasing" |
organizationName | large organization name, e.g. "Onizuka, Inc." |
localityName | locality (city) name, e.g. "Palo Alto" |
stateName | state name, e.g. "California" |
country | two letter country code, e.g. "CH" |
IOException |
---|
Constructs a name from an array of relative distinguished names
rdnArray | array of relative distinguished names |
---|
IOException | on error |
---|
Constructs a name from an ASN.1 encoded value. The encoding of the name in the stream uses DER (a BER/1 subset).
value | a DER-encoded value holding an X.500 name. |
---|
IOException |
---|
Constructs a name from an ASN.1 encoded input stream. The encoding of the name in the stream uses DER (a BER/1 subset).
in | DER-encoded data holding an X.500 name. |
---|
IOException |
---|
Constructs a name from an ASN.1 encoded byte array.
name | DER-encoded byte array holding an X.500 name. |
---|
IOException |
---|
Return an immutable List of the the AVAs contained in all the RDNs of this X500Name.
Get the X500Name contained in the given X500Principal. Note that the X500Name is retrieved using reflection.
Get an X500Principal backed by this X500Name. Note that we are using privileged reflection to access the hidden package private constructor in X500Principal.
Return the total number of AVAs contained in all the RDNs of this X500Name.
Return lowest common ancestor of this name and other name
other | another X500Name |
---|
Return constraint type:
inputName | to be checked for being constrained |
---|
UnsupportedOperationException | if name is not exact match, but narrowing and widening are not supported for this name type. |
---|
This method is deprecated.
Use encode() instead
Encodes the name in DER-encoded form.
out | where to put the DER-encoded X.500 name |
---|
IOException |
---|
Encodes the name in DER-encoded form.
out | where to put the DER-encoded X.500 name |
---|
IOException |
---|
Compares this name with another, for equality.
obj | the reference object with which to compare. |
---|
Find the most specific ("last") attribute of the given type.
Returns a "Common Name" component. If more than one such attribute exists, the topmost one is returned.
IOException |
---|
Returns a "Country" name component. If more than one such attribute exists, the topmost one is returned.
IOException |
---|
Returns a "DN Qualifier" name component. If more than one such component exists, the topmost one is returned.
IOException |
---|
Returns a "Domain" name component. If more than one such component exists, the topmost one is returned.
IOException |
---|
Gets the name in DER-encoded form.
IOException |
---|
Returned the encoding as an uncloned byte array. Callers must guarantee that they neither modify it not expose it to untrusted code.
IOException |
---|
Returns a "Generation Qualifier" name component. If more than one such component exists, the topmost one is returned.
IOException |
---|
Returns a "Given Name" name component. If more than one such component exists, the topmost one is returned.
IOException |
---|
Returns an "IP address" name component. If more than one such component exists, the topmost one is returned.
IOException |
---|
Returns an "Initials" name component. If more than one such component exists, the topmost one is returned.
IOException |
---|
Returns a "Locality" name component. If more than one such component exists, the topmost one is returned.
IOException |
---|
Returns the value of toString(). This call is needed to implement the java.security.Principal interface.
Returns an "Organization" name component. If more than one such attribute exists, the topmost one is returned.
IOException |
---|
Returns an "Organizational Unit" name component. If more than one such attribute exists, the topmost one is returned.
IOException |
---|
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.
IllegalArgumentException |
---|
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.
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.
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.
Returns a "State" name component. If more than one such component exists, the topmost one is returned.
IOException |
---|
Returns a "Surname" name component. If more than one such component exists, the topmost one is returned.
IOException |
---|
Return type of GeneralName.
Calculates a hash code value for the object. Objects which are equal will also have the same hashcode.
Return whether this X500Name is empty. An X500Name is not empty if it has at least one RDN containing at least one AVA.
Return the number of RDNs in this X500Name.
Return subtree depth of this name for purposes of determining NameConstraints minimum and maximum bounds and for calculating path lengths in name subtrees.
UnsupportedOperationException | if not supported for this name type |
---|
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).