Package org.bouncycastle.cert

Examples of org.bouncycastle.cert.X509CRLHolder


      X500Name issuerDN = new X500Name(PrincipalUtil.getIssuerX509Principal(caCert).getName());
      X509v2CRLBuilder crlBuilder = new X509v2CRLBuilder(issuerDN, new Date());

      // build and sign CRL with CA private key
      ContentSigner signer = new JcaContentSignerBuilder(SIGNING_ALGORITHM).setProvider(BC).build(caPrivateKey);
      X509CRLHolder crl = crlBuilder.build(signer);

      File tmpFile = new File(caRevocationList.getParentFile(), Long.toHexString(System.currentTimeMillis()) + ".tmp");
      FileOutputStream fos = null;
      try {
        fos = new FileOutputStream(tmpFile);
        fos.write(crl.getEncoded());
        fos.flush();
        fos.close();
        if (caRevocationList.exists()) {
          caRevocationList.delete();
        }
View Full Code Here


    try {
      X500Name issuerDN = new X500Name(PrincipalUtil.getIssuerX509Principal(cert).getName());
      X509v2CRLBuilder crlBuilder = new X509v2CRLBuilder(issuerDN, new Date());
      if (caRevocationList.exists()) {
        byte [] data = FileUtils.readContent(caRevocationList);
        X509CRLHolder crl = new X509CRLHolder(data);
        crlBuilder.addCRL(crl);
      }
      crlBuilder.addCRLEntry(cert.getSerialNumber(), new Date(), reason.ordinal());

      // build and sign CRL with CA private key
      ContentSigner signer = new JcaContentSignerBuilder("SHA1WithRSA").setProvider(BC).build(caPrivateKey);
      X509CRLHolder crl = crlBuilder.build(signer);

      File tmpFile = new File(caRevocationList.getParentFile(), Long.toHexString(System.currentTimeMillis()) + ".tmp");
      FileOutputStream fos = null;
      try {
        fos = new FileOutputStream(tmpFile);
        fos.write(crl.getEncoded());
        fos.flush();
        fos.close();
        if (caRevocationList.exists()) {
          caRevocationList.delete();
        }
View Full Code Here

        JcaContentSignerBuilder contentBuilder = new JcaContentSignerBuilder("SHA1withRSA").setProvider("BC");

        CRLNumber crlNumber = new CRLNumber(new BigInteger("1234"));
       
        crlBuilder.addExtension(Extension.cRLNumber, false, crlNumber);
        X509CRLHolder x509Crl = crlBuilder.build(contentBuilder.build(issuerPrivateKey));
        return new JcaX509CRLConverter().setProvider("BC").getCRL(x509Crl);
    }
View Full Code Here

      builder.addExtension(X509Extension.authorityKeyIdentifier, false, authorityKeyIdentifier);

      builder.addExtension(X509Extension.cRLNumber, false, new CRLNumber(bcRequest.getNumber()));

      if (bcRequest.getOldCrl() != null) {
        X509CRLHolder current = new X509CRLHolder(bcRequest.getOldCrl());
        builder.addCRL(current);
      }

      PrivateKey privateKey = bcRequest.getIssuerPrivateKey();
      JcaContentSignerBuilder contentSignerBuilder = new JcaContentSignerBuilder(bcRequest.getSignAlgorithm());
      contentSignerBuilder.setProvider(BouncyCastleProviderHelper.PROVIDER_NAME);
      ContentSigner contentSigner = contentSignerBuilder.build(privateKey);

      for (CRLEntry entry : bcRequest.getEntries()) {
        builder.addCRLEntry(entry.getSerialNumber(), entry.getDate(), entry.getReason().getCode());
      }

      X509CRLHolder crlh = builder.build(contentSigner);

      JcaX509CRLConverter crlConverter = new JcaX509CRLConverter();
      crlConverter.setProvider(BouncyCastleProviderHelper.PROVIDER_NAME);
      X509CRL crl = crlConverter.getCRL(crlh);
View Full Code Here

TOP

Related Classes of org.bouncycastle.cert.X509CRLHolder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.