List of usage examples for org.bouncycastle.asn1 ASN1Primitive toASN1Primitive
public final ASN1Primitive toASN1Primitive()
From source file:org.demoiselle.signer.policy.engine.asn1.ASN1Object.java
License:Open Source License
/** * // ww w . jav a 2s.c o m * @param derObject Object to convert * @return org.bouncycastle.asn1.DERSequence Converted sequence or null, if not possible * @see org.bouncycastle.asn1.ASN1Primitive ASN1 primitive */ public static ASN1Sequence getDERSequence(ASN1Primitive derObject) { ASN1Sequence sequence = null; if (derObject instanceof DERTaggedObject) { ASN1Primitive object = ((DERTaggedObject) derObject).getObject(); if (object instanceof DERSequence) { sequence = (DERSequence) object; } } else if (derObject instanceof DERSequence) { sequence = (DERSequence) derObject; } else if (derObject instanceof DLSequence) { sequence = (DLSequence) derObject.toASN1Primitive(); } return sequence; }
From source file:org.ejbca.core.protocol.cmp.AuthenticationModulesTest.java
License:Open Source License
private static CMPCertificate[] getCMPCert(Certificate cert) throws CertificateEncodingException, IOException { ASN1InputStream ins = new ASN1InputStream(cert.getEncoded()); ASN1Primitive pcert = ins.readObject(); ins.close();// w ww. ja v a 2s .c o m org.bouncycastle.asn1.x509.Certificate c = org.bouncycastle.asn1.x509.Certificate .getInstance(pcert.toASN1Primitive()); CMPCertificate[] res = { new CMPCertificate(c) }; return res; }
From source file:org.ejbca.core.protocol.cmp.NestedMessageContentTest.java
License:Open Source License
private static CMPCertificate[] getCMPCert(Certificate cert) throws CertificateEncodingException, IOException { ASN1InputStream ins = new ASN1InputStream(cert.getEncoded()); try {//from www.ja v a2 s . co m ASN1Primitive pcert = ins.readObject(); org.bouncycastle.asn1.x509.Certificate c = org.bouncycastle.asn1.x509.Certificate .getInstance(pcert.toASN1Primitive()); CMPCertificate[] res = { new CMPCertificate(c) }; return res; } finally { ins.close(); } }
From source file:org.ejbca.ui.cmpclient.CmpClientMessageHelper.java
License:Open Source License
private CMPCertificate[] getCMPCerts(Certificate cert) throws CertificateEncodingException, IOException { ASN1InputStream ins = new ASN1InputStream(cert.getEncoded()); ASN1Primitive pcert = ins.readObject(); ins.close();/*from ww w . java 2s . com*/ org.bouncycastle.asn1.x509.Certificate c = org.bouncycastle.asn1.x509.Certificate .getInstance(pcert.toASN1Primitive()); CMPCertificate[] res = { new CMPCertificate(c) }; return res; }