eu.emi.security.authn.x509.helpers
Class JavaAndBCStyle

java.lang.Object
  extended by org.bouncycastle.asn1.x500.style.BCStyle
      extended by eu.emi.security.authn.x509.helpers.JavaAndBCStyle
All Implemented Interfaces:
X500NameStyle

public class JavaAndBCStyle
extends BCStyle

Extends BCStyle with additional recognized attribute names, to make it fully compatible with what the internal OpenJDK implementation supports when parsing string RFC 2253 DNs.

The serialization part of this class (toString(X500Name)) behaves in a different way: it only outputs labels for the attribute names which are recognized by JDK. All other are output as OIDs.

Therefore this class allows to consume even unsupported by the JDK DNs, all supported and convert them to BC RDNs form. On the other hand it allows to convert RDNs to RFC 2253 form ensuring that this form is acceptable by the JDK X500Principal class.

Author:
K. Benedyczak

Field Summary
static JavaAndBCStyle INSTANCE
           
static ASN1ObjectIdentifier IP
           
 
Fields inherited from class org.bouncycastle.asn1.x500.style.BCStyle
BUSINESS_CATEGORY, C, CN, COUNTRY_OF_CITIZENSHIP, COUNTRY_OF_RESIDENCE, DATE_OF_BIRTH, DC, DMD_NAME, DN_QUALIFIER, E, EmailAddress, GENDER, GENERATION, GIVENNAME, INITIALS, L, NAME, NAME_AT_BIRTH, O, OU, PLACE_OF_BIRTH, POSTAL_ADDRESS, POSTAL_CODE, PSEUDONYM, SERIALNUMBER, SN, ST, STREET, SURNAME, T, TELEPHONE_NUMBER, UID, UNIQUE_IDENTIFIER, UnstructuredAddress, UnstructuredName
 
Constructor Summary
JavaAndBCStyle()
           
 
Method Summary
 ASN1ObjectIdentifier attrNameToOID(String attrName)
           
 RDN[] fromString(String dirName)
           
 String toString(X500Name name)
           
 String toString(X500Name name, Hashtable<ASN1ObjectIdentifier,String> mappings)
           
 String toStringFull(X500Name name)
           
 
Methods inherited from class org.bouncycastle.asn1.x500.style.BCStyle
areEqual, calculateHashCode, rdnAreEqual, stringToValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IP

public static final ASN1ObjectIdentifier IP

INSTANCE

public static final JavaAndBCStyle INSTANCE
Constructor Detail

JavaAndBCStyle

public JavaAndBCStyle()
Method Detail

attrNameToOID

public ASN1ObjectIdentifier attrNameToOID(String attrName)
Specified by:
attrNameToOID in interface X500NameStyle
Overrides:
attrNameToOID in class BCStyle

toString

public String toString(X500Name name,
                       Hashtable<ASN1ObjectIdentifier,String> mappings)

fromString

public RDN[] fromString(String dirName)
Specified by:
fromString in interface X500NameStyle
Overrides:
fromString in class BCStyle

toString

public String toString(X500Name name)
Specified by:
toString in interface X500NameStyle
Overrides:
toString in class BCStyle
Parameters:
name -
Returns:
String representation with human readable labels for all attributes known by the JDK.

toStringFull

public String toStringFull(X500Name name)
Parameters:
name -
Returns:
String representation with human readable labels for all known attributes.


Copyright © 2012 European Middleware Initiative. All Rights Reserved.