Java Code Examples for org.bouncycastle.asn1.DERBMPString#getInstance()
The following examples show how to use
org.bouncycastle.asn1.DERBMPString#getInstance() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: X509Ext.java From keystore-explorer with GNU General Public License v3.0 | 6 votes |
private String getMsCertTypeStringValue(byte[] octets) { // @formatter:off /* Not much information available about that extension... 06 09 ; OBJECT_ID (9 Bytes) | 2b 06 01 04 01 82 37 14 02 | ; 1.3.6.1.4.1.311.20.2 Certificate Template Name (Certificate Type) 04 0a ; OCTET_STRING (a Bytes)# 1e 08 00 55 00 73 00 65 00 72 ; ...U.s.e.r */ // @formatter:on DERBMPString derbmpString = DERBMPString.getInstance(octets); return derbmpString.toString(); }
Example 2
Source File: ExtensionSyntaxChecker.java From xipki with Apache License 2.0 | 4 votes |
private static ASN1Encodable getParsedImplicitValue(String name, ASN1TaggedObject taggedObject, FieldType fieldType) throws BadCertTemplateException { try { switch (fieldType) { case BIT_STRING: return DERBitString.getInstance(taggedObject, false); case BMPString: return DERBMPString.getInstance(taggedObject, false); case BOOLEAN: return ASN1Boolean.getInstance(taggedObject, false); case ENUMERATED: return ASN1Enumerated.getInstance(taggedObject, false); case GeneralizedTime: return DERGeneralizedTime.getInstance(taggedObject, false); case IA5String: return DERIA5String.getInstance(taggedObject, false); case INTEGER: return ASN1Integer.getInstance(taggedObject, false); case Name: return X500Name.getInstance(taggedObject, false); case NULL: if (!(taggedObject.getObject() instanceof ASN1OctetString && ((ASN1OctetString) taggedObject.getObject()).getOctets().length == 0)) { throw new BadCertTemplateException("invalid " + name); } return DERNull.INSTANCE; case OCTET_STRING: return DEROctetString.getInstance(taggedObject, false); case OID: return ASN1ObjectIdentifier.getInstance(taggedObject, false); case PrintableString: return DERPrintableString.getInstance(taggedObject, false); case RAW: return taggedObject.getObject(); case SEQUENCE: case SEQUENCE_OF: return ASN1Sequence.getInstance(taggedObject, false); case SET: case SET_OF: return ASN1Set.getInstance(taggedObject, false); case TeletexString: return DERT61String.getInstance(taggedObject, false); case UTCTime: return DERUTCTime.getInstance(taggedObject, false); case UTF8String: return DERUTF8String.getInstance(taggedObject, false); default: throw new RuntimeException("Unknown FieldType " + fieldType); } } catch (IllegalArgumentException ex) { throw new BadCertTemplateException("invalid " + name, ex); } }