public abstract class X509NameEntryConverter
extends java.lang.Object
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); } } }
Constructor and Description |
---|
X509NameEntryConverter() |
Modifier and Type | Method and Description |
---|---|
protected boolean |
canBePrintable(java.lang.String str)
return true if the passed in String can be represented without
loss as a PrintableString, false otherwise.
|
protected ASN1Primitive |
convertHexEncoded(java.lang.String str,
int off)
Convert an inline encoded hex string rendition of an ASN.1
object back into its corresponding ASN.1 object.
|
abstract ASN1Primitive |
getConvertedValue(ASN1ObjectIdentifier oid,
java.lang.String value)
Convert the passed in String value into the appropriate ASN.1
encoded object.
|
protected ASN1Primitive convertHexEncoded(java.lang.String str, int off) throws java.io.IOException
str
- the hex encoded objectoff
- the index at which the encoding startsjava.io.IOException
protected boolean canBePrintable(java.lang.String str)
public abstract ASN1Primitive getConvertedValue(ASN1ObjectIdentifier oid, java.lang.String value)
oid
- the oid associated with the value in the DN.value
- the value of the particular DN component.