|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.rim.device.api.crypto.certificate.x509.X509DistinguishedName
public final class X509DistinguishedName
Represents the ASN.1 type RDNSequence (Relative Distinguished Name).
The following example illustrates the RDNSequence.
RDNSequence ::= SEQUENCE OF RelativeDistinguishedName
RelativeDistinguishedName ::=
SET OF AttributeTypeAndValue
AttributeTypeAndValue ::= SEQUENCE {
attributeType OBJECT IDENTIFIER,
parameters ANY DEFINED BY attributeType }
| Field Summary | ||
|---|---|---|
|
static int |
STRING_FORMAT_DEFAULT
Specifies that the default string format should be used, when passed as a parameter to toString(). |
|
static int |
STRING_FORMAT_RFC2253
Specifies that an RFC2253-compliant string format should be used, when passed as a parameter to toString(). |
| Constructor Summary | ||
|---|---|---|
|
X509DistinguishedName(byte[] encoding)
Creates and initializes a distinguished name ( X509DistinguishedName) object. |
|
|
X509DistinguishedName(byte[] encoding,
int offset,
int length)
Creates and initializes a distinguished name ( X509DistinguishedName) object. |
|
|
X509DistinguishedName(String input)
Creates and initializes a distinguished name ( X509DistinguishedName) object. |
|
|
X509DistinguishedName(String input,
char delimiter)
Creates and initializes a distinguished name ( X509DistinguishedName) object. |
|
|
X509DistinguishedName(ASN1InputStream input)
Creates and initializes a distinguished name ( X509DistinguishedName) object. |
|
| Method Summary | ||
|---|---|---|
|
boolean |
equals(Object obj)
Check that this X509DistinguishedName is equal to obj. |
|
String |
getCommonName()
Retrieve the common name attribute associated with this distinguished name. |
|
String |
getCountry()
Retrieve the country attribute associated with this distinguished name. |
|
String |
getEmailAddress()
Retrieve the email attribute associated with this distinguished name. |
|
byte[] |
getEncoding()
Returns the encoding of the DistinguishedName. |
|
String |
getLocality()
Retrieve the locality attribute associated with this distinguished name. |
|
Enumeration |
getOIDs()
Returns an enumeration of all the OIDs for the names. |
|
String |
getOrganization()
Retrieve the organization attribute associated with this distinguished name. |
|
String |
getOrganizationalUnit()
Retrieve the organization unit attribute associated with this distinguished name. |
|
String |
getStateOrProvince()
Retrieve the state-or-province attribute associated with this distinguished name. |
|
String |
getString(OID oid)
Retrieve the string associated with this OID. |
|
String |
getSurname()
Retrieve the surname attribute associated with this distinguished name. |
|
int |
hashCode()
Returns a hash code value for the object. |
|
String |
toRFC2253CompatibleString()
Convert this DistinguishedName's internal representation to a string format. |
|
String |
toString()
Convert this DistinguishedName's internal representation to a string format. |
|
String |
toString(int stringFormat)
Convert this DistinguishedName's internal representation to a string format. |
| Methods inherited from class java.lang.Object |
|---|
getClass, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static final int STRING_FORMAT_DEFAULT
public static final int STRING_FORMAT_RFC2253
| Constructor Detail |
|---|
public X509DistinguishedName(String input)
throws ASN1EncodingException
X509DistinguishedName) object.
Note that the input is expected to be represented as a comma-delimited list, such
as CN=Joe Johnson, O=Company X, C=US. No ending character is needed, ie. the list
is assumed to be finished with the last character present in the input string. The recognized data
labels are "CN", "SN", "C", "L", "ST", "O", "OU", and "E". Any other labels will be ignored
and not included in the object. This means they won't be a factor in any .equals or comparison
operations. Also note that the ASN1 encoding of this DN
has the tag and value pairs in the order that they appear in input.
Default String encoding type is DERTags.UTF8_STRING except for the label "E" where the encoding type is DERTags.IA5_STRING.
input - An String storing the encoding of the
Distinguished Name, eg "C=Mike, OU=Software, O=RIM". Currently supported strings are:
OIDs.idAtCommonName.
OIDs.idAtSurname.
OIDs.idAtOrganizationalUnitName.
OIDs.idAtOrganizationName.
OIDs.idAtLocalityName.
OIDs.idAtStateOrProvinceName.
OIDs.idAtCountryName.
OIDs.pkcs9_at_emailAddress.
ASN1EncodingException - Thrown if an error occurs reading the input stream.
public X509DistinguishedName(String input,
char delimiter)
throws ASN1EncodingException
X509DistinguishedName) object.
Note that the input is expected to be represented as a delimited list ( delimited by the character delimiter ), such
as CN=Joe Johnson, O=Company X, C=US. No ending character is needed, ie. the list
is assumed to be finished with the last character present in the input string. The recognized data
labels are "CN", "SN", "C", "L", "ST", "O", "OU", and "E". Any other labels will be ignored
and not included in the object. This means they won't be a factor in any .equals or comparison
operations. Also note that the ASN1 encoding of this DN
has the tag and value pairs in the order that they appear in input.
Default String encoding type is DERTags.UTF8_STRING except for the label "E" where the encoding type is DERTags.IA5_STRING.
input - An String storing the encoding of the
Distinguished Name, eg "C=Mike delimiter OU=Software code>delimiter O=RIM". Currently supported strings are:
OIDs.idAtCommonName.
OIDs.idAtSurname.
OIDs.idAtOrganizationalUnitName.
OIDs.idAtOrganizationName.
OIDs.idAtLocalityName.
OIDs.idAtStateOrProvinceName.
OIDs.idAtCountryName.
OIDs.pkcs9_at_emailAddress.
delimiter - A character used to seperate each attribute tag/value pair. The most common values are ',' or ';'
ASN1EncodingException - Thrown if an error occurs reading the input stream.
public X509DistinguishedName(ASN1InputStream input)
throws IOException,
ASN1EncodingException
X509DistinguishedName) object.
input - An ASN1InputStream storing the encoding of the
Distinguished Name.
IOException - Thrown if an I/O error occurs.
ASN1EncodingException - Thrown if an error occurs reading the input stream.
public X509DistinguishedName(byte[] encoding)
throws ASN1EncodingException
X509DistinguishedName) object.
encoding - The DER encoding of this object.
ASN1EncodingException - Thrown if an error occurs reading the input stream.
public X509DistinguishedName(byte[] encoding,
int offset,
int length)
throws ASN1EncodingException
X509DistinguishedName) object.
encoding - The DER encoding of this object.offset - The offset, or start position, of the data within the array.length - The amount of data to read.
ASN1EncodingException - Thrown if an error occurs reading the input stream.| Method Detail |
|---|
public byte[] getEncoding()
DistinguishedName
getEncoding in interface DistinguishedNamepublic boolean equals(Object obj)
obj.
equals in class Objectobj - the reference object with which to compare.
obj equals thisBoolean.hashCode(),
Hashtablepublic String getString(OID oid)
getString in interface DistinguishedNameoid - The oid to look up the string with
public String getCommonName()
getCommonName in interface DistinguishedNamepublic String getEmailAddress()
Note that this function is for legacy only. X509 v3 defines that an email address should be found in the SubjectAltNames certificate extension.
getEmailAddress in interface DistinguishedNamepublic String getSurname()
getSurname in interface DistinguishedNamepublic String getCountry()
getCountry in interface DistinguishedNamepublic String getLocality()
getLocality in interface DistinguishedNamepublic String getStateOrProvince()
getStateOrProvince in interface DistinguishedNamepublic String getOrganization()
getOrganization in interface DistinguishedNamepublic String getOrganizationalUnit()
getOrganizationalUnit in interface DistinguishedNamepublic Enumeration getOIDs()
getOIDs in interface DistinguishedNameOIDs in this DNpublic String toString()
This method will return a string in an RFC2253-like format. All known attribute type keywords will be emitted, including all of the keywords defined in RFC2253 (CN, L, ST, O, OU, C, STREET, DC, UID) as well as some other keywords like email (E). Other attribute types are not emitted. This string format would be useful for display to a user, for example.
Example output would be CN=Amy Krul;O=Research In Motion;C=US;E=akrul@rim.com.
toString in interface DistinguishedNametoString in class Objectpublic String toRFC2253CompatibleString()
This method will return the string in RFC2253-compliant format. The attribute type keywords defined in RFC2253 (CN, L, ST, O, OU, C, STREET, DC, UID) will be emitted. Any other attribute types are emitted in dotted-decimal format. Commas and other special characters within attribute values are escaped.
Example output would be CN=Amy Krul\, Developer,O=Research In Motion,C=US,1.2.840.113549.1.9.1=akrul@rim.com.
public String toString(int stringFormat)
This method will return the string in one of two formats:
STRING_FORMAT_DEFAULT):
All known attribute type keywords
will be emitted, including all of the keywords defined in RFC2253 (CN, L, ST, O, OU, C, STREET, DC, UID)
as well as some other keywords like email (E). Other attribute types are not emitted.
STRING_FORMAT_RFC2253):
The attribute
type keywords defined in RFC2253 (CN, L, ST, O, OU, C, STREET, DC, UID) will be emitted. Any other attribute types
are emitted in dotted-decimal format. Commas and other special characters within attribute values are
escaped.
stringFormat - indicates which of the supported string formats to use
public int hashCode()
Objectjava.util.Hashtable.
The general contract of hashCode is:
hashCode method on each of
the two objects must produce the same integer result.
Object.equals(java.lang.Object)
method, then calling the hashCode method on each of the
two objects must produce distinct integer results. However, the
programmer should be aware that producing distinct integer results
for unequal objects may improve the performance of hashtables.
As much as is reasonably practical, the hashCode method defined by class Object does return distinct integers for distinct objects. (This is typically implemented by converting the internal address of the object into an integer, but this implementation technique is not required by the JavaTM programming language.)
hashCode in class ObjectObject.equals(java.lang.Object),
Hashtable
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
Copyright 1999-2011 Research In Motion Limited. 295 Phillip Street, Waterloo, Ontario, Canada, N2L 3W8. All Rights Reserved.
Java is a trademark of Oracle America Inc. in the US and other countries.
Legal