List of usage examples for org.bouncycastle.asn1.x500.style IETFUtils valueFromHexString
public static ASN1Encodable valueFromHexString(String str, int off) throws IOException
From source file:org.cesecore.util.PrintableStringNameStyle.java
License:Open Source License
@Override public ASN1Encodable stringToValue(ASN1ObjectIdentifier oid, String value) { if (value.length() != 0 && value.charAt(0) == '#') { try {/* w ww.j a v a 2 s .co m*/ return IETFUtils.valueFromHexString(value, 1); } catch (IOException e) { throw new RuntimeException("can't recode value for oid " + oid.getId()); } } else if (value.length() != 0 && value.charAt(0) == '\\') { value = value.substring(1); } else if (oid.equals(CeSecoreNameStyle.EmailAddress) || oid.equals(CeSecoreNameStyle.DC)) { return new DERIA5String(value); } else if (oid.equals(DATE_OF_BIRTH)) // accept time string as well as # (for compatibility) { return new ASN1GeneralizedTime(value); } else if (canBePrintable(value)) { return new DERPrintableString(value); } return new DERUTF8String(value); }