Class X509NameEntryConverter

  • All Implemented Interfaces:

    
    public abstract class X509NameEntryConverter
    
                        

    It turns out that the number of standard ways the fields in a DN should be encoded into their ASN.1 counterparts is rapidly approaching the number of machines on the internet. By default the X509Name class will produce UTF8Strings in line with the current recommendations (RFC 3280).

    An example of an encoder look like below:

    public class X509DirEntryConverter
        extends X509NameEntryConverter
    {
        public ASN1Primitive getConvertedValue(
            ASN1ObjectIdentifier  oid,
            String               value)
        {
            if (str.length() != 0 && str.charAt(0) == '#')
            {
                return convertHexEncoded(str, 1);
            }
            if (oid.equals(EmailAddress))
            {
                return new DERIA5String(str);
            }
            else if (canBePrintable(str))
            {
                return new DERPrintableString(str);
            }
            else if (canBeUTF8(str))
            {
                return new DERUTF8String(str);
            }
            else
            {
                return new DERBMPString(str);
            }
        }
    }
    
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Field Summary

      Fields 
      Modifier and Type Field Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      abstract ASN1Primitive getConvertedValue(ASN1ObjectIdentifier oid, String value) Convert the passed in String value into the appropriate ASN.1 encoded object.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • X509NameEntryConverter

        X509NameEntryConverter()
    • Method Detail

      • getConvertedValue

         abstract ASN1Primitive getConvertedValue(ASN1ObjectIdentifier oid, String value)

        Convert the passed in String value into the appropriate ASN.1 encoded object.

        Parameters:
        oid - the oid associated with the value in the DN.
        value - the value of the particular DN component.
        Returns:

        the ASN.1 equivalent for the value.