Ejemplo n.º 1
0
 public byte[] getEncoded() throws CRLException {
   try {
     return c.getEncoded(ASN1Encoding.DER);
   } catch (IOException e) {
     throw new CRLException(e.toString());
   }
 }
  // unsigned CRLs at the root of CMS structure (outside signerInfos)
  public Collection<CRL> getUnsignedCRLs() {
    try {
      Collection<CertificateList> crlCollection = cmsSignedData.getCRLs().getMatches(null);

      // Then we need to "cast" from bouncycastle.CertificateList to java.CRL
      Collection<CRL> x509CrlsCollection = new HashSet<CRL>(crlCollection.size());
      for (CertificateList certList : crlCollection) {
        x509CrlsCollection.add(
            CertificateFactory.getInstance("X.509", BouncyCastleProvider.PROVIDER_NAME)
                .generateCRL(new ByteArrayInputStream(certList.getEncoded())));
      }
      return x509CrlsCollection;
    } catch (Exception e) {
      ExceptionHandlerTyped.<SPISignatureException>handle(SPISignatureException.class, e);
    }
    return null;
  }
Ejemplo n.º 3
0
 public PKCS12SafeBagBuilder(CertificateList crl) throws IOException {
   this.bagType = PKCSObjectIdentifiers.crlBag;
   this.bagValue =
       new CertBag(PKCSObjectIdentifiers.x509Crl, new DEROctetString(crl.getEncoded()));
 }