List of usage examples for org.bouncycastle.asn1.x509 TBSCertList getInstance
public static TBSCertList getInstance(Object obj)
From source file:be.fedict.trust.service.bean.HarvesterMDB.java
License:Open Source License
/** * Added for as {@link X509CRL#getRevokedCertificates()} is memory intensive * because it is returning a complete set, for huge CRL's this can get kinda * out of hand. So we return an enumeration of the DER * {@link TBSCertList.CRLEntry} objects. * // w ww . j a v a 2 s .c om * @param crl * the CRL * @return {@link Enumeration} of {@link TBSCertList.CRLEntry}'s. * @throws IOException * something went wrong parsing. * @throws CRLException * something went wrong parsing. */ @SuppressWarnings("unchecked") private Enumeration<TBSCertList.CRLEntry> getRevokedCertificatesEnum(X509CRL crl) throws IOException, CRLException { byte[] certList = crl.getTBSCertList(); ByteArrayInputStream bais = new ByteArrayInputStream(certList); ASN1InputStream aIn = new ASN1InputStream(bais, Integer.MAX_VALUE, true); ASN1Sequence seq = (ASN1Sequence) aIn.readObject(); TBSCertList cl = TBSCertList.getInstance(seq); return cl.getRevokedCertificateEnumeration(); }
From source file:eu.europa.ec.markt.dss.validation102853.crl.CRLToken.java
License:Open Source License
/** * @return the a copy of x509crl as a X509CRLHolder *///from w ww.j a va2 s.c o m public X509CRLHolder getX509CrlHolder() { try { final X509CRL x509crl = getX509crl(); final TBSCertList tbsCertList = TBSCertList.getInstance(x509crl.getTBSCertList()); final AlgorithmIdentifier sigAlgOID = new AlgorithmIdentifier( new ASN1ObjectIdentifier(x509crl.getSigAlgOID())); final byte[] signature = x509crl.getSignature(); final X509CRLHolder x509crlHolder = new X509CRLHolder(new CertificateList( new DERSequence(new ASN1Encodable[] { tbsCertList, sigAlgOID, new DERBitString(signature) }))); return x509crlHolder; } catch (CRLException e) { throw new DSSException(e); } }
From source file:eu.europa.esig.dss.cades.signature.CAdESLevelBaselineLT.java
License:Open Source License
/** * @return the a copy of x509crl as a X509CRLHolder *//* w w w . ja va 2 s .c o m*/ private X509CRLHolder getX509CrlHolder(CRLToken crlToken) { try { final X509CRL x509crl = crlToken.getX509crl(); final TBSCertList tbsCertList = TBSCertList.getInstance(x509crl.getTBSCertList()); final AlgorithmIdentifier sigAlgOID = new AlgorithmIdentifier( new ASN1ObjectIdentifier(x509crl.getSigAlgOID())); final byte[] signature = x509crl.getSignature(); final DERSequence seq = new DERSequence( new ASN1Encodable[] { tbsCertList, sigAlgOID, new DERBitString(signature) }); final CertificateList x509CRL = new CertificateList(seq); // final CertificateList x509CRL = new // CertificateList.getInstance((Object)seq); final X509CRLHolder x509crlHolder = new X509CRLHolder(x509CRL); return x509crlHolder; } catch (CRLException e) { throw new DSSException(e); } }
From source file:eu.europa.esig.dss.x509.crl.CRLToken.java
License:Open Source License
/** * @return the a copy of x509crl as a X509CRLHolder *///from ww w . j av a 2 s . co m public X509CRLHolder getX509CrlHolder() { try { final X509CRL x509crl = getX509crl(); final TBSCertList tbsCertList = TBSCertList.getInstance(x509crl.getTBSCertList()); final AlgorithmIdentifier sigAlgOID = new AlgorithmIdentifier( new ASN1ObjectIdentifier(x509crl.getSigAlgOID())); final byte[] signature = x509crl.getSignature(); final DERSequence seq = new DERSequence( new ASN1Encodable[] { tbsCertList, sigAlgOID, new DERBitString(signature) }); final CertificateList x509CRL = new CertificateList(seq); // final CertificateList x509CRL = new // CertificateList.getInstance((Object)seq); final X509CRLHolder x509crlHolder = new X509CRLHolder(x509CRL); return x509crlHolder; } catch (CRLException e) { throw new DSSException(e); } }