| java.lang.Object sun.security.x509.X500Name
X500Name | public class X500Name implements GeneralNameInterface,Principal(Code) | | 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:
- attribute values encoded in different types (e.g.,
PrintableString and BMPString) may be assumed to represent
different strings;
- attribute values in types other than PrintableString are case
sensitive (this permits matching of attribute values as binary
objects);
- attribute values in PrintableString are not case sensitive
(e.g., "Marianne Swanson" is the same as "MARIANNE SWANSON"); and
- 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.
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.
author: David Brownell author: Amit Kapoor author: Hemma Prafullchandra version: 1.47 See Also: GeneralName See Also: GeneralNames See Also: GeneralNameInterface |
Constructor Summary | |
public | X500Name(String dname) Constructs a name from a conventionally formatted string, such
as "CN=Dave, OU=JavaSoft, O=Sun Microsystems, C=US". | public | X500Name(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. | public | X500Name(String commonName, String organizationUnit, String organizationName, String country) 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.
Parameters: commonName - common name of a person, e.g. | public | X500Name(String commonName, String organizationUnit, String organizationName, String localityName, String stateName, String country) 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.
Parameters: commonName - common name of a person, e.g. | public | X500Name(RDN[] rdnArray) | public | X500Name(DerValue value) Constructs a name from an ASN.1 encoded value. | public | X500Name(DerInputStream in) Constructs a name from an ASN.1 encoded input stream. | public | X500Name(byte[] name) Constructs a name from an ASN.1 encoded byte array. |
X500Name | public X500Name(String dname) throws IOException(Code) | | 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).
Parameters: DN - X.500 Distinguished Name |
X500Name | public X500Name(String dname, String format) throws IOException(Code) | | 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.
Parameters: DN - X.500 Distinguished Name |
X500Name | public X500Name(String commonName, String organizationUnit, String organizationName, String country) throws IOException(Code) | | 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.
Parameters: commonName - common name of a person, e.g. "Vivette Davis" Parameters: organizationUnit - small organization name, e.g. "Purchasing" Parameters: organizationName - large organization name, e.g. "Onizuka, Inc." Parameters: country - two letter country code, e.g. "CH" |
X500Name | public X500Name(String commonName, String organizationUnit, String organizationName, String localityName, String stateName, String country) throws IOException(Code) | | 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.
Parameters: commonName - common name of a person, e.g. "Vivette Davis" Parameters: organizationUnit - small organization name, e.g. "Purchasing" Parameters: organizationName - large organization name, e.g. "Onizuka, Inc." Parameters: localityName - locality (city) name, e.g. "Palo Alto" Parameters: stateName - state name, e.g. "California" Parameters: country - two letter country code, e.g. "CH" |
X500Name | public X500Name(RDN[] rdnArray) throws IOException(Code) | | Constructs a name from an array of relative distinguished names
Parameters: rdnArray - array of relative distinguished names throws: IOException - on error |
X500Name | public X500Name(DerValue value) throws IOException(Code) | | Constructs a name from an ASN.1 encoded value. The encoding
of the name in the stream uses DER (a BER/1 subset).
Parameters: value - a DER-encoded value holding an X.500 name. |
X500Name | public X500Name(DerInputStream in) throws IOException(Code) | | Constructs a name from an ASN.1 encoded input stream. The encoding
of the name in the stream uses DER (a BER/1 subset).
Parameters: in - DER-encoded data holding an X.500 name. |
X500Name | public X500Name(byte[] name) throws IOException(Code) | | Constructs a name from an ASN.1 encoded byte array.
Parameters: name - DER-encoded byte array holding an X.500 name. |
allAvas | public List allAvas()(Code) | | Return an immutable List of the the AVAs contained in all the
RDNs of this X500Name.
|
asX500Name | public static X500Name asX500Name(X500Principal p)(Code) | | Get the X500Name contained in the given X500Principal.
Note that the X500Name is retrieved using reflection.
|
asX500Principal | public X500Principal asX500Principal()(Code) | | Get an X500Principal backed by this X500Name.
Note that we are using privileged reflection to access the hidden
package private constructor in X500Principal.
|
avaSize | public int avaSize()(Code) | | Return the total number of AVAs contained in all the RDNs of
this X500Name.
|
commonAncestor | public X500Name commonAncestor(X500Name other)(Code) | | Return lowest common ancestor of this name and other name
Parameters: other - another X500Name X500Name of lowest common ancestor; null if none |
constrains | public int constrains(GeneralNameInterface inputName) throws UnsupportedOperationException(Code) | | Return constraint type:
- NAME_DIFF_TYPE = -1: input name is different type from this name
(i.e. does not constrain)
- NAME_MATCH = 0: input name matches this name
- NAME_NARROWS = 1: input name narrows this name
- NAME_WIDENS = 2: input name widens this name
- NAME_SAME_TYPE = 3: input name does not match or narrow this name,
& but is same type
. These results are used in checking NameConstraints during
certification path verification.
Parameters: inputName - to be checked for being constrained throws: UnsupportedOperationException - if name is not exact match, but narrowing and widening are not supported for this name type. |
countQuotes | static int countQuotes(String string, int from, int to)(Code) | | |
emit | public void emit(DerOutputStream out) throws IOException(Code) | | Encodes the name in DER-encoded form.
Parameters: out - where to put the DER-encoded X.500 name |
encode | public void encode(DerOutputStream out) throws IOException(Code) | | Encodes the name in DER-encoded form.
Parameters: out - where to put the DER-encoded X.500 name |
equals | public boolean equals(Object obj)(Code) | | Compares this name with another, for equality.
true iff the names are identical. |
findMostSpecificAttribute | public DerValue findMostSpecificAttribute(ObjectIdentifier attribute)(Code) | | Find the most specific ("last") attribute of the given
type.
|
getCommonName | public String getCommonName() throws IOException(Code) | | Returns a "Common Name" component. If more than one such
attribute exists, the topmost one is returned.
"CN=" component of the name, if any. |
getCountry | public String getCountry() throws IOException(Code) | | Returns a "Country" name component. If more than one
such attribute exists, the topmost one is returned.
"C=" component of the name, if any. |
getDNQualifier | public String getDNQualifier() throws IOException(Code) | | Returns a "DN Qualifier" name component. If more than one
such component exists, the topmost one is returned.
"DNQ=" component of the name, if any. |
getDomain | public String getDomain() throws IOException(Code) | | Returns a "Domain" name component. If more than one
such component exists, the topmost one is returned.
"DC=" component of the name, if any. |
getEncoded | public byte[] getEncoded() throws IOException(Code) | | Gets the name in DER-encoded form.
the DER encoded byte array of this name. |
getEncodedInternal | public byte[] getEncodedInternal() throws IOException(Code) | | Returned the encoding as an uncloned byte array. Callers must
guarantee that they neither modify it not expose it to untrusted
code.
|
getGeneration | public String getGeneration() throws IOException(Code) | | Returns a "Generation Qualifier" name component. If more than one
such component exists, the topmost one is returned.
"GENERATION=" component of the name, if any. |
getGivenName | public String getGivenName() throws IOException(Code) | | Returns a "Given Name" name component. If more than one
such component exists, the topmost one is returned.
"GIVENNAME=" component of the name, if any. |
getIP | public String getIP() throws IOException(Code) | | Returns an "IP address" name component. If more than one
such component exists, the topmost one is returned.
"IP=" component of the name, if any. |
getInitials | public String getInitials() throws IOException(Code) | | Returns an "Initials" name component. If more than one
such component exists, the topmost one is returned.
"INITIALS=" component of the name, if any. |
getLocality | public String getLocality() throws IOException(Code) | | Returns a "Locality" name component. If more than one
such component exists, the topmost one is returned.
"L=" component of the name, if any. |
getName | public String getName()(Code) | | Returns the value of toString(). This call is needed to
implement the java.security.Principal interface.
|
getOrganization | public String getOrganization() throws IOException(Code) | | Returns an "Organization" name component. If more than
one such attribute exists, the topmost one is returned.
"O=" component of the name, if any. |
getOrganizationalUnit | public String getOrganizationalUnit() throws IOException(Code) | | Returns an "Organizational Unit" name component. If more
than one such attribute exists, the topmost one is returned.
"OU=" component of the name, if any. |
getRFC1779Name | public String getRFC1779Name()(Code) | | 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.
|
getRFC2253CanonicalName | public String getRFC2253CanonicalName()(Code) | | |
getRFC2253Name | public String getRFC2253Name()(Code) | | 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.
|
getState | public String getState() throws IOException(Code) | | Returns a "State" name component. If more than one
such component exists, the topmost one is returned.
"S=" component of the name, if any. |
getSurname | public String getSurname() throws IOException(Code) | | Returns a "Surname" name component. If more than one
such component exists, the topmost one is returned.
"SURNAME=" component of the name, if any. |
getType | public int getType()(Code) | | Return type of GeneralName.
|
hashCode | public int hashCode()(Code) | | Calculates a hash code value for the object. Objects
which are equal will also have the same hashcode.
|
isEmpty | public boolean isEmpty()(Code) | | Return whether this X500Name is empty. An X500Name is not empty
if it has at least one RDN containing at least one AVA.
|
rdns | public List rdns()(Code) | | Return an immutable List of all RDNs in this X500Name.
|
size | public int size()(Code) | | Return the number of RDNs in this X500Name.
|
toString | public String toString()(Code) | | 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 1779, 2253, and 2459).
|
|
|