public class X500Name extends java.lang.Object implements java.security.Principal, GeneralNameInterface
This class exposes only partial X.500 name functionality. Most notably, it works best if Relative Distinguished Names only have one (unique) attribute each, and if only the most common attributes need to be visible to applications. This limitation, and others, will be lifted over time.
GeneralName
,
GeneralNames
,
GeneralNameInterface
,
RDN
,
AVA
,
LdapDNStrConverter
,
Serialized FormModifier and Type | Field and Description |
---|---|
static ObjectIdentifier |
commonName_oid
OID for the "CN=" attribute, denoting a person's common name.
|
static ObjectIdentifier |
countryName_oid
OID for the "C=" attribute, denoting a country.
|
static ObjectIdentifier |
email_oid
OID for the "E=" attribute, denoting a person's email address.
|
static ObjectIdentifier |
ipAddress_oid
OID for "IP=" IP address attributes, used with SKIP.
|
static ObjectIdentifier |
localityName_oid
OID for the "L=" attribute, denoting a locality (such as a city)
|
static ObjectIdentifier |
orgName_oid
OID for the "O=" attribute, denoting an organization name
|
static ObjectIdentifier |
orgUnitName_oid
OID for the "OU=" attribute, denoting an organizational unit name
|
static ObjectIdentifier |
stateName_oid
OID for the "S=" attribute, denoting a state (such as Delaware)
|
static ObjectIdentifier |
streetAddress_oid
OID for the "STREET=" attribute, denoting a street address.
|
static ObjectIdentifier |
title_oid
OID for the "T=" attribute, denoting a person's title.
|
static ObjectIdentifier |
uidName_oid
OID for the "UID=" attribute, denoting a person's ID.
|
NAME_ANY, NAME_DIRECTORY, NAME_DNS, NAME_EDI, NAME_IP, NAME_OID, NAME_RFC822, NAME_URI, NAME_X400
Constructor and Description |
---|
X500Name(byte[] name)
Constructs a name from an ASN.1 encoded byte array.
|
X500Name(DerInputStream in)
Constructs a name from an ASN.1 encoded input stream.
|
X500Name(DerValue value)
Constructs a name from an ASN.1 encoded value.
|
X500Name(RDN[] rdns)
Constructs a X500Name from array of RDN.
|
X500Name(java.lang.String ldapDNString)
Constructs a name from a Ldap DN string, such
as "CN=Dave, OU=JavaSoft, O=Sun Microsystems, C=US".
|
X500Name(java.lang.String ldapDNString,
byte[] tags) |
X500Name(java.lang.String ldapDNString,
LdapDNStrConverter ldapDNStrConverter)
Constructs a X500Name from a Ldap DN String using the specified
LdapDNStrConverter.
|
X500Name(java.lang.String ldapDNString,
LdapDNStrConverter ldapDNStrConverter,
byte[] tags)
Constructs a X500Name from a Ldap DN String using the specified
LdapDNStrConverter.
|
X500Name(java.lang.String commonName,
java.lang.String organizationUnit,
java.lang.String organizationName,
java.lang.String country)
Constructs a X500Name from fields common in enterprise application
environments.
|
X500Name(java.lang.String commonName,
java.lang.String organizationUnit,
java.lang.String organizationName,
java.lang.String localityName,
java.lang.String stateName,
java.lang.String country)
Constructs a X500Name from fields common in Internet application
environments.
|
X500Name(java.util.Vector<RDN> rdnVector)
convenience method.
|
Modifier and Type | Method and Description |
---|---|
void |
encode(DerOutputStream out)
Encodes the name in DER-encoded form.
|
boolean |
equals(java.lang.Object obj) |
java.util.List<java.lang.String> |
getAttributesForOid(ObjectIdentifier oid)
Return a list of attributes of the given type.
|
java.lang.String |
getCommonName()
Returns a "Common Name" component.
|
java.lang.String |
getCountry()
Returns a "Country" name component.
|
java.lang.String |
getEmail()
Returns a "Email" name component.
|
byte[] |
getEncoded()
Gets the name in DER-encoded form.
|
java.lang.String |
getLocality()
Returns a "Locality" name component.
|
java.lang.String |
getName()
Returns the value of toString().
|
RDN[] |
getNames()
Returns an array of RDN in the X500Name.
|
int |
getNamesLength()
Returns the number of RDNs in the X500Name.
|
java.lang.String |
getOrganization()
Returns an "Organization" name component.
|
java.lang.String |
getOrganizationalUnit()
Returns an "Organizational Unit" name component.
|
java.util.Enumeration<RDN> |
getRDNs()
Returns an enumerator of RDNs in the X500Name.
|
java.lang.String |
getState()
Returns a "State" name component.
|
int |
getType()
Return type of GeneralName.
|
java.lang.String |
getUserID()
Returns a "UID" component.
|
int |
hashCode() |
java.lang.String |
toLdapDNString()
Returns a Ldap DN String from the X500Name using the global default
LdapDNStrConverter
|
java.lang.String |
toLdapDNString(LdapDNStrConverter ldapDNStrConverter)
Returns a Ldap DN String from the X500Name
using the specified LdapDNStrconverter.
|
java.lang.String |
toString()
Returns a Ldap DN string, using the global default LdapDNStrConverter
or null if an error occurs in the conversion.
|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
validSingle, validSubtree
public static final ObjectIdentifier commonName_oid
public static final ObjectIdentifier uidName_oid
public static final ObjectIdentifier countryName_oid
public static final ObjectIdentifier localityName_oid
public static final ObjectIdentifier orgName_oid
public static final ObjectIdentifier orgUnitName_oid
public static final ObjectIdentifier stateName_oid
public static final ObjectIdentifier streetAddress_oid
public static final ObjectIdentifier title_oid
public static final ObjectIdentifier email_oid
public static final ObjectIdentifier ipAddress_oid
public X500Name(java.lang.String ldapDNString) throws java.io.IOException
ldapDNString
- a Ldap DN String e.g. as defined in RFC1779java.io.IOException
public X500Name(java.lang.String ldapDNString, LdapDNStrConverter ldapDNStrConverter, byte[] tags) throws java.io.IOException
ldapDNString
- a Ldap DN String e.g. as defined in RFC1779.ldapDNStrConverter
- A LdapDNStrConverterjava.io.IOException
LdapDNStrConverter
public X500Name(java.lang.String ldapDNString, byte[] tags) throws java.io.IOException
java.io.IOException
public X500Name(java.lang.String ldapDNString, LdapDNStrConverter ldapDNStrConverter) throws java.io.IOException
ldapDNString
- a Ldap DN String e.g. as defined in RFC1779.ldapDNStrConverter
- A LdapDNStrConverterjava.io.IOException
LdapDNStrConverter
public X500Name(java.lang.String commonName, java.lang.String organizationUnit, java.lang.String organizationName, java.lang.String country) throws java.io.IOException
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"java.io.IOException
public X500Name(java.lang.String commonName, java.lang.String organizationUnit, java.lang.String organizationName, java.lang.String localityName, java.lang.String stateName, java.lang.String country) throws java.io.IOException
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"java.io.IOException
public X500Name(DerValue value) throws java.io.IOException
value
- a DER-encoded value holding an X.500 name.java.io.IOException
public X500Name(DerInputStream in) throws java.io.IOException
in
- DER-encoded data holding an X.500 name.java.io.IOException
public X500Name(byte[] name) throws java.io.IOException
name
- DER-encoded byte array holding an X.500 name.java.io.IOException
public X500Name(RDN[] rdns) throws java.io.IOException
rdns
- an array of RDN.java.io.IOException
public X500Name(java.util.Vector<RDN> rdnVector) throws java.io.IOException
rdnVector
- a vector of rdns.java.io.IOException
public int hashCode()
hashCode
in interface java.security.Principal
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in interface java.security.Principal
equals
in class java.lang.Object
public int getType()
getType
in interface GeneralNameInterface
public java.lang.String getCountry() throws java.io.IOException
java.io.IOException
public java.lang.String getOrganization() throws java.io.IOException
java.io.IOException
public java.lang.String getOrganizationalUnit() throws java.io.IOException
java.io.IOException
public java.lang.String getCommonName() throws java.io.IOException
java.io.IOException
public java.lang.String getUserID() throws java.io.IOException
java.io.IOException
public java.lang.String getLocality() throws java.io.IOException
java.io.IOException
public java.lang.String getState() throws java.io.IOException
java.io.IOException
public java.lang.String getEmail() throws java.io.IOException
java.io.IOException
public java.lang.String toLdapDNString() throws java.io.IOException
java.io.IOException
LdapDNStrConverter
public java.util.List<java.lang.String> getAttributesForOid(ObjectIdentifier oid) throws java.io.IOException
java.io.IOException
public java.lang.String toLdapDNString(LdapDNStrConverter ldapDNStrConverter) throws java.io.IOException
ldapDNStrConverter
- a LdapDNStrConverterjava.io.IOException
LdapDNStrConverter
public java.lang.String toString()
toString
in interface java.security.Principal
toString
in class java.lang.Object
public java.lang.String getName()
getName
in interface java.security.Principal
public java.util.Enumeration<RDN> getRDNs()
public RDN[] getNames()
public int getNamesLength()
public void encode(DerOutputStream out) throws java.io.IOException
encode
in interface GeneralNameInterface
out
- where to put the DER-encoded X.500 namejava.io.IOException
- thrown if the GeneralName could not be
encoded.public byte[] getEncoded() throws java.io.IOException
java.io.IOException