public static Certificate getCertificate(ASN1Encodable object) throws BadAsn1ObjectException { try { return Certificate.getInstance(object); } catch (IllegalArgumentException ex) { throw new BadAsn1ObjectException("invalid object Certificate: " + ex.getMessage(), ex); } }
public static Certificate getCertificate(final ASN1Encodable object) throws BadAsn1ObjectException { try { return Certificate.getInstance(object); } catch (IllegalArgumentException ex) { throw new BadAsn1ObjectException("invalid object Certificate: " + ex.getMessage(), ex); } }
public static Certificate getInstance( ASN1TaggedObject obj, boolean explicit) { return getInstance(ASN1Sequence.getInstance(obj, explicit)); }
private EncryptedPrivateKeyData createPrivateKeySequence(EncryptedPrivateKeyInfo encryptedPrivateKeyInfo, Certificate[] chain) throws CertificateEncodingException { org.bouncycastle.asn1.x509.Certificate[] certChain = new org.bouncycastle.asn1.x509.Certificate[chain.length]; for (int i = 0; i != chain.length; i++) { certChain[i] = org.bouncycastle.asn1.x509.Certificate.getInstance(chain[i].getEncoded()); } return new EncryptedPrivateKeyData(encryptedPrivateKeyInfo, certChain); }
private static Certificate getCertificate0(ASN1Encodable object) throws BadAsn1ObjectException { try { return Certificate.getInstance(object); } catch (IllegalArgumentException ex) { throw new BadAsn1ObjectException("invalid object Certificate: " + ex.getMessage(), ex); } }
public static Certificate getInstance( ASN1TaggedObject obj, boolean explicit) { return getInstance(ASN1Sequence.getInstance(obj, explicit)); }
static org.bouncycastle.asn1.x509.Certificate loadCertificateResource( String resource) throws IOException { PemObject pem = loadPemResource(resource); if (pem.getType().endsWith("CERTIFICATE")) { return org.bouncycastle.asn1.x509.Certificate.getInstance(pem .getContent()); } throw new IllegalArgumentException( "'resource' doesn't specify a valid certificate"); }
public static Certificate readCertificate(InputStream stream) throws FileNotFoundException, CertificateException, IOException { CertificateFactory certFactory = CertificateFactory.getInstance("X.509"); Collection<? extends java.security.cert.Certificate> certs = certFactory.generateCertificates(stream); java.security.cert.Certificate sunCert = (java.security.cert.Certificate) certs.toArray()[0]; byte[] certBytes = sunCert.getEncoded(); ASN1Primitive asn1Cert = TlsUtils.readASN1Object(certBytes); org.bouncycastle.asn1.x509.Certificate cert = org.bouncycastle.asn1.x509.Certificate.getInstance(asn1Cert); org.bouncycastle.asn1.x509.Certificate[] certs2 = new org.bouncycastle.asn1.x509.Certificate[1]; certs2[0] = cert; org.bouncycastle.crypto.tls.Certificate tlsCerts = new org.bouncycastle.crypto.tls.Certificate(certs2); return tlsCerts; }
public Certificate[] getCertificates() { if (certificates == null) { return null; } Certificate[] certs = new Certificate[certificates.size()]; for (int i = 0; i != certs.length; i++) { certs[i] = Certificate.getInstance(certificates.getObjectAt(i)); } return certs; }
private Certificate readPEMCertificate( InputStream in) throws IOException, CertificateParsingException { ASN1Sequence seq = PEM_PARSER.readPEMObject(in); if (seq != null) { return new X509CertificateObject( org.bouncycastle.asn1.x509.Certificate.getInstance(seq)); } return null; }
static org.bouncycastle.asn1.x509.Certificate loadCertificateResource(String resource) throws IOException { PemObject pem = loadPemResource(resource); if (pem.getType().endsWith("CERTIFICATE")) { return org.bouncycastle.asn1.x509.Certificate.getInstance(pem.getContent()); } throw new IllegalArgumentException("'resource' doesn't specify a valid certificate"); }
static org.bouncycastle.asn1.x509.Certificate loadCertificateResource( String resource) throws IOException { PemObject pem = loadPemResource(resource); if (pem.getType().endsWith("CERTIFICATE")) { return org.bouncycastle.asn1.x509.Certificate.getInstance(pem .getContent()); } throw new IllegalArgumentException( "'resource' doesn't specify a valid certificate"); }
public AddCertParams(P11SlotIdentifier slotId, P11NewObjectControl control, X509Certificate certificate) { this.slotId = Args.notNull(slotId, "slotId"); this.control = Args.notNull(control, "control"); Args.notNull(certificate, "certificate"); byte[] encoded; try { encoded = certificate.getEncoded(); } catch (CertificateEncodingException ex) { throw new IllegalArgumentException("could not encode certificate: " + ex.getMessage(), ex); } this.certificate = Certificate.getInstance(encoded); }
public Asn1ObjectIdAndCert(Asn1P11SlotIdentifier slotId, Asn1P11ObjectIdentifier objectId, X509Certificate certificate) { this.slotId = ParamUtil.requireNonNull("slotId", slotId); this.objectId = ParamUtil.requireNonNull("objectId", objectId); ParamUtil.requireNonNull("certificate", certificate); byte[] encoded; try { encoded = certificate.getEncoded(); } catch (CertificateEncodingException ex) { throw new IllegalArgumentException("could not encode certificate: " + ex.getMessage(), ex); } this.certificate = Certificate.getInstance(encoded); }
public ObjectIdAndCert(SlotIdentifier slotId, ObjectIdentifier objectId, X509Certificate certificate) { this.slotId = Args.notNull(slotId, "slotId"); this.objectId = Args.notNull(objectId, "objectId"); Args.notNull(certificate, "certificate"); byte[] encoded; try { encoded = certificate.getEncoded(); } catch (CertificateEncodingException ex) { throw new IllegalArgumentException("could not encode certificate: " + ex.getMessage(), ex); } this.certificate = Certificate.getInstance(encoded); }
public Asn1AddCertParams(P11SlotIdentifier slotId, P11NewObjectControl control, X509Certificate certificate) { this.slotId = ParamUtil.requireNonNull("slotId", slotId); this.control = ParamUtil.requireNonNull("control", control); ParamUtil.requireNonNull("certificate", certificate); byte[] encoded; try { encoded = certificate.getEncoded(); } catch (CertificateEncodingException ex) { throw new IllegalArgumentException("could not encode certificate: " + ex.getMessage(), ex); } this.certificate = Certificate.getInstance(encoded); }
public Asn1EntityIdAndCert(final P11EntityIdentifier entityId, final X509Certificate certificate) { ParamUtil.requireNonNull("entityId", entityId); ParamUtil.requireNonNull("certificate", certificate); this.entityId = new Asn1P11EntityIdentifier(entityId); byte[] encoded; try { encoded = certificate.getEncoded(); } catch (CertificateEncodingException ex) { throw new IllegalArgumentException("could not encode certificate: " + ex.getMessage(), ex); } this.certificate = Certificate.getInstance(encoded); }
public EjbcaCaInfo(final int caId, final byte[] certBytes, final String caDirname) { ParamUtil.requireNonNull("certBytes", certBytes); this.caId = caId; this.hexSha1 = HashAlgoType.SHA1.hexHash(certBytes).toLowerCase(); this.subject = Certificate.getInstance(certBytes).getSubject(); this.caDirname = ParamUtil.requireNonNull("caDirname", caDirname); }
public static org.bouncycastle.asn1.x509.Certificate parseBcCert(byte[] certBytes) throws CertificateException { Args.notNull(certBytes, "certBytes"); try { return org.bouncycastle.asn1.x509.Certificate.getInstance(toDerEncoded(certBytes)); } catch (IllegalArgumentException ex) { throw new CertificateEncodingException("the given one is not a valid X.509 certificate"); } }
private EncryptedPrivateKeyData(ASN1Sequence seq) { encryptedPrivateKeyInfo = EncryptedPrivateKeyInfo.getInstance(seq.getObjectAt(0)); ASN1Sequence certSeq = ASN1Sequence.getInstance(seq.getObjectAt(1)); certificateChain = new Certificate[certSeq.size()]; for (int i = 0; i != certificateChain.length; i++) { certificateChain[i] = Certificate.getInstance(certSeq.getObjectAt(i)); } }