org.glite.security.util
Class DNHandler

java.lang.Object
  extended by org.glite.security.util.DNHandler

public class DNHandler
extends java.lang.Object

Distinguished Name (DN) handling routines. These routines are separated into this separate class to ensure the DN is always handled the same way. This separation also makes changing the handling easy in case when for example the encoding changes or there is need for changes in internationalization support.

Author:
Joni Hahkala Created on August 26, 2003, 10:21 AM

Field Summary
static java.util.Hashtable s_rfc2253Lookup
          symbol table for printing the RDN identifiers, with "Email"
static java.util.Hashtable s_rfc2253v2Lookup
          symbol table for printing the RDN identifiers, with "emailAddress"
 
Constructor Summary
DNHandler()
           
 
Method Summary
static DN getDN(java.security.Principal principal)
          Generates a DN object form the Principal object.
static DN getDN(java.lang.String inputDN)
          Deprecated. Use getDNRFC2253(String inputDN) instead for proper reversed RFC 2253 DN support. This assumes DN that is not reversed.
static DN getDN(org.bouncycastle.asn1.x509.X509Name x509Name)
          Generates a DN object form the X509Name object.
static DN getDNRFC2253(java.lang.String inputDN)
          Generates a DN object from a String.
static DN getIssuer(java.security.cert.X509Certificate cert)
          Picks up the issuer from the certificate as a DN class without any transformations etc.
static DN getSubject(java.security.cert.X509Certificate cert)
          Picks up the subject from the certificate as a DN class without any transformations etc.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

s_rfc2253v2Lookup

public static java.util.Hashtable s_rfc2253v2Lookup
symbol table for printing the RDN identifiers, with "emailAddress"


s_rfc2253Lookup

public static java.util.Hashtable s_rfc2253Lookup
symbol table for printing the RDN identifiers, with "Email"

Constructor Detail

DNHandler

public DNHandler()
Method Detail

getIssuer

public static DN getIssuer(java.security.cert.X509Certificate cert)
Picks up the issuer from the certificate as a DN class without any transformations etc.

Parameters:
cert - The certificate to the the issuer from.
Returns:
The DN class representation of the issuer.

getSubject

public static DN getSubject(java.security.cert.X509Certificate cert)
Picks up the subject from the certificate as a DN class without any transformations etc.

Parameters:
cert - The certificate to the the issuer from.
Returns:
The DN class representation of the subject.

getDN

public static DN getDN(java.security.Principal principal)
Generates a DN object form the Principal object.

Parameters:
principal - The Principal to get the DN from.
Returns:
The DN class representation of the DN.

getDN

public static DN getDN(org.bouncycastle.asn1.x509.X509Name x509Name)
Generates a DN object form the X509Name object.

Parameters:
x509Name - The X509Name to get the DN from.
Returns:
The DN class representation of the DN.

getDN

public static DN getDN(java.lang.String inputDN)
Deprecated. Use getDNRFC2253(String inputDN) instead for proper reversed RFC 2253 DN support. This assumes DN that is not reversed.

Generates a DN object form a String. If the string starts with a slash character, it is assumed to be old openssl X500 form, e.g. "/C=FR/O=Acme/CN=John Doe". Otherwise the string is assumed to be pseudo RFC 2253 format DN in the direct order in violation of RFC2253, e.g. "C=FR, O=Acme, CN=John Doe".

Parameters:
inputDN - The string to get the DN from.
Returns:
The DN class representation of the DN.

getDNRFC2253

public static DN getDNRFC2253(java.lang.String inputDN)
Generates a DN object from a String. If the string starts with a slash character, it is assumed to be old openssl X500 form, e.g. "/C=FR/O=Acme/CN=John Doe". Otherwise the string is assumed to be RFC 2253 format DN in the reverse order as described in RFC2253, e.g. "CN=John Doe, O=Acme, C=FR".

Parameters:
inputDN - The string to get the DN from.
Returns:
The DN class representation of the DN.