List of usage examples for org.bouncycastle.asn1.x509 X509Name DC
ASN1ObjectIdentifier DC
To view the source code for org.bouncycastle.asn1.x509 X509Name DC.
Click Source Link
From source file:net.java.bd.tools.security.X509BDJEntryConverter.java
License:Open Source License
public DERObject getConvertedValue(DERObjectIdentifier oid, String value) { if (value.length() != 0 && value.charAt(0) == '#') { try {/*from w w w . ja v a2 s . c o m*/ 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); //} else if (oid.equals(X509Name.C) || oid.equals(X509Name.SN) || oid.equals(X509Name.DN_QUALIFIER)){ // Blu-ray Specific, require UTF8String. MHP 12.5.6. } else if (oid.equals(X509Name.SN) || oid.equals(X509Name.DN_QUALIFIER)) { return new DERPrintableString(value); } return new DERUTF8String(value); }
From source file:org.cesecore.certificates.util.dn.PrintableStringEntryConverter.java
License:Open Source License
/** * Apply default coversion for the given value depending on the oid * and the character range of the value. * // w w w. j a v a 2 s .c o m * @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 (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 (canBePrintable(value)) { return new DERPrintableString(value); } else if (canBeUTF8(value)) { return new DERUTF8String(value); } return new DERBMPString(value); }
From source file:org.glite.voms.PKIUtils.java
License:Open Source License
/** * Gets an OpenSSL-style representation of a principal. * * @param principal the principal/*w w w. j av a 2s . c om*/ * * @return a String representing the principal. */ public static String getOpenSSLFormatPrincipal(Principal principal) { X509Name name = new X509Name(principal.getName()); Vector oids = name.getOIDs(); Vector values = name.getValues(); ListIterator oids_iter = oids.listIterator(); ListIterator values_iter = values.listIterator(); String result = new String(); while (oids_iter.hasNext()) { DERObjectIdentifier oid = (DERObjectIdentifier) oids_iter.next(); String value = (String) values_iter.next(); if (oid.equals(X509Name.C)) result += "/C=" + value; else if (oid.equals(X509Name.CN)) result += "/CN=" + value; else if (oid.equals(X509Name.DC)) result += "/DC=" + value; else if (oid.equals(X509Name.E)) result += "/E=" + value; else if (oid.equals(X509Name.EmailAddress)) result += "/Email=" + value; else if (oid.equals(X509Name.L)) result += "/L=" + value; else if (oid.equals(X509Name.O)) result += "/O=" + value; else if (oid.equals(X509Name.OU)) result += "/OU=" + value; else if (oid.equals(X509Name.ST)) result += "/ST=" + value; else if (oid.equals(X509Name.UID)) result += "/UID=" + value; else result += "/" + oid.toString() + "=" + value; } logger.debug("SSLFormat: " + result); return result; }