|
Oracle Fusion Middleware Security Engine Java API Reference for Oracle Security Developer Tools 11g Release 1 (11.1.1) E10674-05 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
oracle.security.crypto.cert.Entity
oracle.security.crypto.cert.X500Name
public class X500Name
This class represents distinguished names as used in the X.500 series of specifications, defined in X.520.
A X500Name is an Entity with support for some additional X.500 attributes. In addition to common name (which is the same as the entity name), the following attributes are supported using the old API methods: country, organization, organizational-unit, locality, state or province, and email. Using the new API methods, these as well as any other standard or custom attributes can be supported.
NB: It is an error to mix calls to methods used for definining attributes from both the old and new APIs.
This class implements hashCode and equals methods, and so may be used for keys in a hashtable.
Warning: The serialization capability of this class should only be used for short-term storage and RMI between applications running the same version of this product. It should not be relied on for long-term perisistence, as future versions of this class may use an incompatible serialization format. For now, applications requiring long-term persistence should use the ASN.1 encodings provided by the input(InputStream) and output(OutputStream) methods directly, instead of serialization.
X509, X500RDN, Serialized Form| Constructor Summary | |
|---|---|
X500Name()Creates a new, empty X.500 name (one with no attributes). |
|
X500Name(java.io.InputStream is) |
|
X500Name(java.lang.String str)Parse an X.500 name from a string (e.g., one produced by toString). |
|
| Method Summary | |
|---|---|
void |
addComponent(oracle.security.crypto.asn1.ASN1ObjectID type, oracle.security.crypto.asn1.ASN1String value)Add the specified type-and-value pair to this X500Name as a new component. |
void |
addComponent(oracle.security.crypto.asn1.ASN1ObjectID type, java.lang.String value)Add the specified type-and-value pair to this X500Name as a new component. |
void |
addComponent(java.lang.String name, java.lang.String value)Add the specified name-and-value pair to this X500Name as a new component; the name will be mapped to its registered OID. |
void |
addComponent(X500RDN rdn)Add the specified X500RDN to this X500Name as a new component. |
X500RDN |
componentAt(int i) |
java.util.Enumeration<X500RDN> |
components()Deprecated. Use getComponentsAsList() and then get Iterator |
boolean |
equals(java.lang.Object o)Compares this X.500 name to the specified object, which must be of type X500Name or X500Principal. |
X500RDN |
getAttribute(oracle.security.crypto.asn1.ASN1ObjectID type)Returns the first X500RDN with the given attribute type. |
X500RDN |
getAttribute(java.lang.String name)Returns the first X500RDN with the given attribute name. |
oracle.security.crypto.asn1.ASN1Object |
getAttributeValue(oracle.security.crypto.asn1.ASN1ObjectID type)Gets the value for the first X500RDN with the given attribute type. |
oracle.security.crypto.asn1.ASN1Object |
getAttributeValue(java.lang.String name)Gets the value for the first X500RDN with the given attribute name. |
java.lang.String |
getCommonName() |
java.util.Vector<X500RDN> |
getComponents()Deprecated. Use getComponentsAsList() |
java.util.ArrayList<X500RDN> |
getComponentsAsList() |
java.lang.String |
getCountryName() |
java.lang.String |
getEmail() |
java.lang.String |
getLocalityName() |
java.lang.String |
getOrganizationName() |
java.lang.String |
getOrgUnitName() |
java.lang.String |
getStateName() |
int |
hashCode() |
void |
input(java.io.InputStream is)Initializes this X.500 name by reading its DER-encoding from the specified input stream. |
void |
input(java.lang.String s)Initializes this X.500 name by reading its description from the specified string. |
int |
length() |
void |
output(java.io.OutputStream os)Output to the specified output stream. |
void |
readExternal(java.io.ObjectInput is) |
void |
setAttr(java.lang.String name, java.lang.String value)Sets the attribute of this X.500 name indicated by the given string. |
void |
setCommonName(java.lang.String s) |
void |
setCountryName(java.lang.String s) |
void |
setEmail(java.lang.String s) |
void |
setLocalityName(java.lang.String s) |
void |
setOrganizationName(java.lang.String s) |
void |
setOrgUnitName(java.lang.String s) |
void |
setStateName(java.lang.String s) |
int |
size() |
java.lang.String |
toString()Returns a string representation of this X500Name. |
static X500Name |
toX500Name(javax.security.auth.x500.X500Principal p) |
javax.security.auth.x500.X500Principal |
toX500Principal() |
void |
writeExternal(java.io.ObjectOutput os) |
| Methods inherited from class oracle.security.crypto.cert.Entity |
|---|
getName, setName |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public X500Name()
public X500Name(java.lang.String str)
toString). The following notation is used: attr=value, attr=value, ... There shall be no space around the equal sign or before the comma. A comma in the value may be escaped using a backslash. The attribute names are case-insensitive. The following attribute names are supported: C, ST, L, O, OU, CN, EMAIL.
toString(), equals(java.lang.Object)
public X500Name(java.io.InputStream is)
throws java.io.IOException
java.io.IOException| Method Detail |
|---|
public static X500Name toX500Name(javax.security.auth.x500.X500Principal p)
public void addComponent(X500RDN rdn)
X500RDN to this X500Name as a new component.
public void addComponent(oracle.security.crypto.asn1.ASN1ObjectID type,
oracle.security.crypto.asn1.ASN1String value)
X500Name as a new component.for defined OIDs from the id_at arc.
public void addComponent(oracle.security.crypto.asn1.ASN1ObjectID type,
java.lang.String value)
X500Name as a new component.
The string value will be converted to an ASN1String of the appropriate type (IA5String, UTF8String, PrintableString) depending on the character composition of the value.
for defined OIDs from the id_at arc., X500RDN.addAttribute(ASN1ObjectID type, String value)
public void addComponent(java.lang.String name,
java.lang.String value)
X500Name as a new component; the name will be mapped to its registered OID.
The following names are recognized by default: C, ST, L, O, OU, CN, Email (or EmailAddress) Additional names may be mapped to OIDs at run-time using the oracle.security.crypto.util.OIDManager.setAttributeTypeName method.
public oracle.security.crypto.asn1.ASN1Object getAttributeValue(java.lang.String name)
X500RDN with the given attribute name.name - Code for which attribute to get (e.g. "C" for country name).ASN1String value of the given attribute, or null if it has not been defined.public oracle.security.crypto.asn1.ASN1Object getAttributeValue(oracle.security.crypto.asn1.ASN1ObjectID type)
X500RDN with the given attribute type.type - OID for which attribute to get.ASN1String value of the given attribute, or null if it has not been defined.public X500RDN getAttribute(java.lang.String name)
X500RDN with the given attribute name.name - Code for which attribute to get (e.g. "C" for country name).X500RDN with the given attribute name, or null if it has not been defined.public X500RDN getAttribute(oracle.security.crypto.asn1.ASN1ObjectID type)
X500RDN with the given attribute type.type - OID for which attribute to get.X500RDN with the given attribute type, or null if it has not been defined.
public void input(java.io.InputStream is)
throws java.io.IOException
input in interface oracle.security.crypto.util.Streamablejava.io.IOException
public void input(java.lang.String s)
throws oracle.security.crypto.util.InvalidFormatException
oracle.security.crypto.util.InvalidFormatException - If the string is not the correct format
public void output(java.io.OutputStream os)
throws java.io.IOException
Note: If the old API methods are used to define the attributes the the order of output is as follows: C, ST, L, O, OU, CN, EMAIL.
output in interface oracle.security.crypto.util.Streamablejava.io.IOExceptionpublic int length()
length in interface oracle.security.crypto.util.Streamablepublic java.lang.String toString()
X500Name. The output of this method is suitable for use in the constructor X500Name(String). The order of entries is the reverse of the order produced by the output method.toString in class java.lang.ObjectX500Name(String), output(OutputStream)public java.util.Vector<X500RDN> getComponents()
getComponentsAsList()public java.util.ArrayList<X500RDN> getComponentsAsList()
public java.util.Enumeration<X500RDN> components()
getComponentsAsList() and then get Iteratorpublic int size()
public X500RDN componentAt(int i)
public java.lang.String getCountryName()
public void setCountryName(java.lang.String s)
public java.lang.String getStateName()
public void setStateName(java.lang.String s)
public java.lang.String getLocalityName()
public void setLocalityName(java.lang.String s)
public java.lang.String getOrganizationName()
public void setOrganizationName(java.lang.String s)
public java.lang.String getOrgUnitName()
public void setOrgUnitName(java.lang.String s)
public java.lang.String getCommonName()
public void setCommonName(java.lang.String s)
public java.lang.String getEmail()
public void setEmail(java.lang.String s)
public void setAttr(java.lang.String name,
java.lang.String value)
attr - Code for which attributes to set (e.g. "C" for country name).val - Value to which the attribute will be set.public boolean equals(java.lang.Object o)
Compares this X.500 name to the specified object, which must be of type X500Name or X500Principal. Returns true if and only if the argument is not null, and represents the same X.500 name. For the purposes of this comparison operation, two X.500 names are considered the same if and only if all the attributes recognized by this implementation have the same value.
equals in class Entitypublic int hashCode()
hashCode in class java.lang.Objectpublic javax.security.auth.x500.X500Principal toX500Principal()
public void writeExternal(java.io.ObjectOutput os)
throws java.io.IOException
writeExternal in interface java.io.ExternalizablewriteExternal in class Entityjava.io.IOException
public void readExternal(java.io.ObjectInput is)
throws java.io.IOException,
java.lang.ClassNotFoundException
readExternal in interface java.io.ExternalizablereadExternal in class Entityjava.io.IOExceptionjava.lang.ClassNotFoundException
|
Oracle Fusion Middleware Security Engine Java API Reference for Oracle Security Developer Tools 11g Release 1 (11.1.1) E10674-05 |
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||