Class JavaAndBCStyle
- java.lang.Object
-
- org.bouncycastle.asn1.x500.style.AbstractX500NameStyle
-
- org.bouncycastle.asn1.x500.style.BCStyle
-
- eu.emi.security.authn.x509.helpers.JavaAndBCStyle
-
- All Implemented Interfaces:
org.bouncycastle.asn1.x500.X500NameStyle
public class JavaAndBCStyle extends org.bouncycastle.asn1.x500.style.BCStyle
ExtendsBCStyle
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
Fields Modifier and Type Field Description static java.util.Hashtable<org.bouncycastle.asn1.ASN1ObjectIdentifier,java.lang.String>
asn2StringAll
All mappings which are supported by the JDK impl (see sun.security.x509.AVA class).static JavaAndBCStyle
INSTANCE
static org.bouncycastle.asn1.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, defaultLookUp, defaultSymbols, DESCRIPTION, DMD_NAME, DN_QUALIFIER, E, EmailAddress, GENDER, GENERATION, GIVENNAME, INITIALS, L, NAME, NAME_AT_BIRTH, O, ORGANIZATION_IDENTIFIER, OU, PLACE_OF_BIRTH, POSTAL_ADDRESS, POSTAL_CODE, PSEUDONYM, ROLE, SERIALNUMBER, SN, ST, STREET, SURNAME, T, TELEPHONE_NUMBER, UID, UNIQUE_IDENTIFIER, UnstructuredAddress, UnstructuredName
-
-
Constructor Summary
Constructors Constructor Description JavaAndBCStyle()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.bouncycastle.asn1.ASN1ObjectIdentifier
attrNameToOID(java.lang.String attrName)
org.bouncycastle.asn1.x500.RDN[]
fromString(java.lang.String dirName)
java.lang.String
getLabelForOid(org.bouncycastle.asn1.ASN1ObjectIdentifier oid)
java.lang.String
getLabelForOidFull(org.bouncycastle.asn1.ASN1ObjectIdentifier oid)
java.lang.String
toString(org.bouncycastle.asn1.x500.X500Name name)
java.lang.String
toString(org.bouncycastle.asn1.x500.X500Name name, java.util.Hashtable<org.bouncycastle.asn1.ASN1ObjectIdentifier,java.lang.String> mappings)
java.lang.String
toStringFull(org.bouncycastle.asn1.x500.X500Name name)
-
Methods inherited from class org.bouncycastle.asn1.x500.style.BCStyle
encodeStringValue, oidToAttrNames, oidToDisplayName
-
-
-
-
Field Detail
-
asn2StringAll
public static final java.util.Hashtable<org.bouncycastle.asn1.ASN1ObjectIdentifier,java.lang.String> asn2StringAll
All mappings which are supported by the JDK impl (see sun.security.x509.AVA class). and the BCStyle.
-
IP
public static final org.bouncycastle.asn1.ASN1ObjectIdentifier IP
-
INSTANCE
public static final JavaAndBCStyle INSTANCE
-
-
Method Detail
-
attrNameToOID
public org.bouncycastle.asn1.ASN1ObjectIdentifier attrNameToOID(java.lang.String attrName)
- Specified by:
attrNameToOID
in interfaceorg.bouncycastle.asn1.x500.X500NameStyle
- Overrides:
attrNameToOID
in classorg.bouncycastle.asn1.x500.style.BCStyle
-
toString
public java.lang.String toString(org.bouncycastle.asn1.x500.X500Name name, java.util.Hashtable<org.bouncycastle.asn1.ASN1ObjectIdentifier,java.lang.String> mappings)
-
fromString
public org.bouncycastle.asn1.x500.RDN[] fromString(java.lang.String dirName)
- Specified by:
fromString
in interfaceorg.bouncycastle.asn1.x500.X500NameStyle
- Overrides:
fromString
in classorg.bouncycastle.asn1.x500.style.BCStyle
-
toString
public java.lang.String toString(org.bouncycastle.asn1.x500.X500Name name)
- Specified by:
toString
in interfaceorg.bouncycastle.asn1.x500.X500NameStyle
- Overrides:
toString
in classorg.bouncycastle.asn1.x500.style.BCStyle
- Parameters:
name
- name- Returns:
- String representation with human readable labels for all attributes known by the JDK.
-
toStringFull
public java.lang.String toStringFull(org.bouncycastle.asn1.x500.X500Name name)
- Parameters:
name
- name- Returns:
- String representation with human readable labels for all known attributes.
-
getLabelForOid
public java.lang.String getLabelForOid(org.bouncycastle.asn1.ASN1ObjectIdentifier oid)
- Parameters:
oid
- oid- Returns:
- String label for the oid if it is known by the JDK
-
getLabelForOidFull
public java.lang.String getLabelForOidFull(org.bouncycastle.asn1.ASN1ObjectIdentifier oid)
- Parameters:
oid
- oid- Returns:
- String label for the oid if it is among all known attributes
-
-