FileDocCategorySizeDatePackage
X509DefaultEntryConverter.javaAPI DocAndroid 1.5 API1549Wed May 06 22:41:06 BST 2009org.bouncycastle.asn1.x509

X509DefaultEntryConverter

public class X509DefaultEntryConverter extends X509NameEntryConverter
The default converter for X509 DN entries when going from their string value to ASN.1 strings.

Fields Summary
Constructors Summary
Methods Summary
public org.bouncycastle.asn1.DERObjectgetConvertedValue(org.bouncycastle.asn1.DERObjectIdentifier oid, java.lang.String value)
Apply default coversion for the given value depending on the oid and the character range of the value.

param
oid the object identifier for the DN entry
param
value the value associated with it
return
the ASN.1 equivalent for the string value.

        if (value.length() != 0 && value.charAt(0) == '#")
        {
            try
            {
                return convertHexEncoded(value, 1);
            }
            catch (IOException e)
            {
                throw new RuntimeException("can't recode value for oid " + oid.getId());
            }
        }
        else if (oid.equals(X509Name.EmailAddress) || oid.equals(X509Name.DC))
        {
            return new DERIA5String(value);
        }
        else if (oid.equals(X509Name.DATE_OF_BIRTH))
        {
            return new DERGeneralizedTime(value);
        }
        
        return new DERUTF8String(value);