iaik.me.asn1
Class Name

java.lang.Object
  |
  +--iaik.me.asn1.Name

public class Name
extends Object

The X.500 Distinguished Name. It is used to identify principals in certificates and certificates requests.

See Also:
X509Certificate, CertificateRequest

Constructor Summary
Name()
          Create a new, empty name.
Name(ASN1 asn1)
          Create a name from its ASN.1 structure.
Name(byte[] b)
          Create a name from its encoding.
 
Method Summary
 void addRDN(String oid, ASN1 value)
          Add a new RDN to this name.
 void addRDN(String oid, String value)
          Add a new RDN to this name.
static void checkValid(ASN1 asn1)
          Check if the given ASN.1 structure is a valid X.500 name.
 void clearASN1()
          Clear the internally stored ASN.1 structure.
 void clearEncoded()
          Clear the encoding for this name.
 boolean equals(Object obj)
          Test to names for equality.
 ASN1 getASN1()
          Get the ASN.1 structure for this name.
 byte[] getEncoded()
          Get the DER encoding of this name.
 String getRDN(String oid)
          Get the value for oid.
 String[] getRDNs(String oid)
          Get all values for oid.
 int hashCode()
           
 String toString()
          Return a string representation for this name.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Name

public Name(ASN1 asn1)
     throws IOException
Create a name from its ASN.1 structure.

Name

public Name(byte[] b)
     throws IOException
Create a name from its encoding.

Name

public Name()
Create a new, empty name.
Method Detail

addRDN

public void addRDN(String oid,
                   String value)
Add a new RDN to this name. Equivalent to addRDN(oid, ASN1.makeString(value)).

addRDN

public void addRDN(String oid,
                   ASN1 value)
Add a new RDN to this name. Actually not a RDN is added but a AVA. The oid should be one of OID_NAME_* defined in the ASN1 class

getRDN

public String getRDN(String oid)
Get the value for oid.

getRDNs

public String[] getRDNs(String oid)
Get all values for oid. If there are no matches an empty array is returned.

checkValid

public static void checkValid(ASN1 asn1)
                       throws IOException
Check if the given ASN.1 structure is a valid X.500 name. Note that the ObjectIds used are not checked.

getASN1

public ASN1 getASN1()
Get the ASN.1 structure for this name. Parsed from the encoding if necessary.

clearASN1

public void clearASN1()
Clear the internally stored ASN.1 structure. Only the DER encoding is stored after this method has been called, which frees up memory. The ASN.1 structure is recreated later if needed.

getEncoded

public byte[] getEncoded()
Get the DER encoding of this name.

clearEncoded

public void clearEncoded()
Clear the encoding for this name. This is course saves memory over storing both the ASN.1 structure and the encoding but note that the ASN.1 structure takes up much more memory than the encoding. The encoding will be recreated when needed for other method calls.

toString

public String toString()
Return a string representation for this name.
Overrides:
toString in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

equals

public boolean equals(Object obj)
Test to names for equality. Names are considered equal iff their encoding are identical.
Overrides:
equals in class Object

This Javadoc may contain text parts from IETF Internet Standard specifications, see copyright note) and RSA Data Security Public-Key Cryptography Standards (see copyright note).

IAIK-JCE ME 3.04, (c) 2002 IAIK, (c) 2003 to 2006 Stiftung SIC