List of usage examples for org.bouncycastle.asn1 DERT61String DERT61String
public DERT61String(String string)
From source file:ClientOCSPDriver.java
License:Open Source License
/** * Apply ASN1 coversion for the given value depending on the oid * and the character range of the value. */*w w w . j av a 2s .c om*/ * This code was taken and modified from X509DefaultEntryConverter.java file * of BouncyCastle. Modify this code to match the ASN1 type for your requestor subject DN * Refer Bouncycastle X509DefaultEntryConverter.java source for implementation of methods * such as convertHexEncoded, canBePrintable and canBeUTF8 * * @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. * */ public DERObject getConvertedValue(DERObjectIdentifier oid, String value) { if (oid.equals(X509Name.O) || oid.equals(X509Name.OU)) { return new DERT61String(value); } else /*if (canBePrintable(value)) */ { return new DERPrintableString(value); } }
From source file:org.xipki.ca.api.profile.DirectoryStringType.java
License:Open Source License
public ASN1Encodable createDirectoryString(final String text) { if (teletexString == this) { return new DERT61String(text); } else if (printableString == this) { return new DERPrintableString(text); } else if (utf8String == this) { return new DERUTF8String(text); } else if (bmpString == this) { return new DERBMPString(text); } else {//from ww w . j av a2 s. c o m throw new RuntimeException("should not reach here, unkown DirectoryStringType '" + text + "'"); } }
From source file:org.xipki.pki.ca.api.profile.DirectoryStringType.java
License:Open Source License
public ASN1Encodable createDirectoryString(final String text) { ParamUtil.requireNonNull("text", text); if (teletexString == this) { return new DERT61String(text); } else if (printableString == this) { return new DERPrintableString(text); } else if (utf8String == this) { return new DERUTF8String(text); } else if (bmpString == this) { return new DERBMPString(text); } else {//from www . j a va 2 s.co m throw new RuntimeException("should not reach here, unknown DirectoryStringType " + this.name()); } }
From source file:org.xipki.pki.ca.api.profile.StringType.java
License:Open Source License
public ASN1Encodable createString(final String text) { ParamUtil.requireNonNull("text", text); if (teletexString == this) { return new DERT61String(text); } else if (printableString == this) { return new DERPrintableString(text); } else if (utf8String == this) { return new DERUTF8String(text); } else if (bmpString == this) { return new DERBMPString(text); } else if (ia5String == this) { return new DERIA5String(text, true); } else {/* ww w. jav a 2 s .c o m*/ throw new RuntimeException("should not reach here, unknown StringType " + this.name()); } }