List of usage examples for org.bouncycastle.asn1 BERTags IA5_STRING
int IA5_STRING
To view the source code for org.bouncycastle.asn1 BERTags IA5_STRING.
Click Source Link
From source file:de.tsenger.animamea.asn1.CVCertBody.java
License:Open Source License
public CVCertBody(DERApplicationSpecific derApp) throws IllegalArgumentException, IOException { if (derApp.getApplicationTag() != 0x4E) throw new IllegalArgumentException("contains no Certifcate Body with tag 0x7F4E"); else//from w w w . j a v a 2 s . c o m cvcbody = derApp; ASN1Sequence bodySeq = (ASN1Sequence) cvcbody.getObject(BERTags.SEQUENCE); profileIdentifier = (ASN1Integer) ((DERApplicationSpecific) bodySeq.getObjectAt(0)) .getObject(BERTags.INTEGER); authorityReference = (DERIA5String) ((DERApplicationSpecific) bodySeq.getObjectAt(1)) .getObject(BERTags.IA5_STRING); ASN1Sequence pkSeq = (ASN1Sequence) ((DERApplicationSpecific) bodySeq.getObjectAt(2)) .getObject(BERTags.SEQUENCE); ASN1ObjectIdentifier pkOid = (ASN1ObjectIdentifier) pkSeq.getObjectAt(0); if (pkOid.toString().startsWith("0.4.0.127.0.7.2.2.2.2")) { publicKey = new AmECPublicKey(pkSeq); } else if (pkOid.toString().startsWith("0.4.0.127.0.7.2.2.2.1")) { publicKey = new AmRSAPublicKey(pkSeq); } chr = (DERIA5String) ((DERApplicationSpecific) bodySeq.getObjectAt(3)).getObject(BERTags.IA5_STRING); ASN1Sequence chatSeq = (ASN1Sequence) ((DERApplicationSpecific) bodySeq.getObjectAt(4)) .getObject(BERTags.SEQUENCE); chat = new CertificateHolderAuthorizationTemplate(chatSeq); effectiveDate = (DEROctetString) ((DERApplicationSpecific) bodySeq.getObjectAt(5)) .getObject(BERTags.OCTET_STRING); expirationDate = (DEROctetString) ((DERApplicationSpecific) bodySeq.getObjectAt(6)) .getObject(BERTags.OCTET_STRING); if (bodySeq.size() > 7) { extensions = (ASN1Sequence) ((DERApplicationSpecific) bodySeq.getObjectAt(7)) .getObject(BERTags.SEQUENCE); } }
From source file:org.jruby.ext.openssl.X509Name.java
License:LGPL
public static void createX509Name(Ruby runtime, RubyModule mX509) { RubyClass cX509Name = mX509.defineClassUnder("Name", runtime.getObject(), X509NAME_ALLOCATOR); RubyClass openSSLError = runtime.getModule("OpenSSL").getClass("OpenSSLError"); mX509.defineClassUnder("NameError", openSSLError, openSSLError.getAllocator()); cX509Name.defineAnnotatedMethods(X509Name.class); cX509Name.setConstant("COMPAT", runtime.newFixnum(COMPAT)); cX509Name.setConstant("RFC2253", runtime.newFixnum(RFC2253)); cX509Name.setConstant("ONELINE", runtime.newFixnum(ONELINE)); cX509Name.setConstant("MULTILINE", runtime.newFixnum(MULTILINE)); cX509Name.setConstant("DEFAULT_OBJECT_TYPE", runtime.newFixnum(BERTags.UTF8_STRING)); RubyHash hash = new RubyHash(runtime, runtime.newFixnum(BERTags.UTF8_STRING)); hash.op_aset(runtime.getCurrentContext(), runtime.newString("C"), runtime.newFixnum(BERTags.PRINTABLE_STRING)); hash.op_aset(runtime.getCurrentContext(), runtime.newString("countryName"), runtime.newFixnum(BERTags.PRINTABLE_STRING)); hash.op_aset(runtime.getCurrentContext(), runtime.newString("serialNumber"), runtime.newFixnum(BERTags.PRINTABLE_STRING)); hash.op_aset(runtime.getCurrentContext(), runtime.newString("dnQualifier"), runtime.newFixnum(BERTags.PRINTABLE_STRING)); hash.op_aset(runtime.getCurrentContext(), runtime.newString("DC"), runtime.newFixnum(BERTags.IA5_STRING)); hash.op_aset(runtime.getCurrentContext(), runtime.newString("domainComponent"), runtime.newFixnum(BERTags.IA5_STRING)); hash.op_aset(runtime.getCurrentContext(), runtime.newString("emailAddress"), runtime.newFixnum(BERTags.IA5_STRING)); cX509Name.setConstant("OBJECT_TYPE_TEMPLATE", hash); cX509Name.includeModule(runtime.getComparable()); }