org.bouncycastle.cert.X509v2CRLBuilder类的使用及代码示例

x33g5p2x  于2022-02-03 转载在 其他  
字(6.4k)|赞(0)|评价(0)|浏览(150)

本文整理了Java中org.bouncycastle.cert.X509v2CRLBuilder类的一些代码示例,展示了X509v2CRLBuilder类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。X509v2CRLBuilder类的具体详情如下:
包路径:org.bouncycastle.cert.X509v2CRLBuilder
类名称:X509v2CRLBuilder

X509v2CRLBuilder介绍

暂无

代码示例

代码示例来源:origin: apache/zookeeper

private void buildCRL(X509Certificate x509Certificate, String crlPath) throws Exception {
  X509v2CRLBuilder builder = new JcaX509v2CRLBuilder(x509Certificate.getIssuerX500Principal(), certStartTime);
  builder.addCRLEntry(x509Certificate.getSerialNumber(), certStartTime, CRLReason.cACompromise);
  builder.setNextUpdate(certEndTime);
  builder.addExtension(Extension.authorityKeyIdentifier, false, new JcaX509ExtensionUtils()
      .createAuthorityKeyIdentifier(rootCertificate));
  builder.addExtension(Extension.cRLNumber, false, new CRLNumber(new BigInteger("1000")));
  X509CRLHolder cRLHolder = builder.build(contentSigner);
  PemWriter pemWriter = new PemWriter(new FileWriter(crlPath));
  pemWriter.writeObject(new MiscPEMGenerator(cRLHolder));
  pemWriter.flush();
  pemWriter.close();
}

代码示例来源:origin: puppetlabs/certificate-authority

Date nextUpdate = now.plusYears(5).toDate();
X509v2CRLBuilder builder = new JcaX509v2CRLBuilder(issuer, issueDate);
builder.setNextUpdate(nextUpdate);
builder.addExtension(Extension.authorityKeyIdentifier, false,
           new AuthorityKeyIdentifierStructure(issuerPublicKey));
builder.addExtension(Extension.cRLNumber, false, new CRLNumber(BigInteger.ZERO));
ContentSigner signer =
  new JcaContentSignerBuilder("SHA256withRSA").build(issuerPrivateKey);
return new JcaX509CRLConverter().getCRL(builder.build(signer));

代码示例来源:origin: org.opendaylight.snbi/southplugin

public static void createCRL(String name) {
    X500NameBuilder builder = new X500NameBuilder(BCStyle.INSTANCE);
//        builder.addRDN(BCStyle.C, defaults.get("COUNTRY"));
//        builder.addRDN(BCStyle.O, defaults.get("ORGANIZATION"));
    // builder.addRDN(BCStyle.ST, defaults.get("STATE"));
    // builder.addRDN(BCStyle.T, defaults.get("TITLE"));
    builder.addRDN(BCStyle.SN, BigInteger.valueOf(System.currentTimeMillis()).toString());
    builder.addRDN(BCStyle.CN, name);
    Calendar now = Calendar.getInstance();
    Date notBefore = now.getTime();
    now.add(Calendar.YEAR, 3);
    Date notAfter = now.getTime();
    X509v2CRLBuilder crlGen = new X509v2CRLBuilder(builder.build(),notBefore);
    crlGen.setNextUpdate(notAfter);
  }

代码示例来源:origin: gitblit/fathom

X509v2CRLBuilder crlBuilder = new X509v2CRLBuilder(issuerDN, new Date());
X509CRLHolder crl = crlBuilder.build(signer);

代码示例来源:origin: org.xipki/ca-server

crlBuilder.addExtension(ObjectIdentifiers.id_xipki_ext_crlCertset, false, new DERSet(vector));
} catch (CertIOException ex) {
 throw new OperationException(INVALID_EXTENSION, "CertIOException: " + ex.getMessage());

代码示例来源:origin: puppetlabs/ssl-utils

Date nextUpdate = now.plusYears(5).toDate();
X509v2CRLBuilder builder = new JcaX509v2CRLBuilder(issuer, issueDate);
builder.setNextUpdate(nextUpdate);
builder.addExtension(Extension.authorityKeyIdentifier, false,
           new JcaX509ExtensionUtils().createAuthorityKeyIdentifier(issuerPublicKey));
builder.addExtension(Extension.cRLNumber, false, new CRLNumber(BigInteger.ZERO));
ContentSigner signer =
  new JcaContentSignerBuilder("SHA256withRSA").build(issuerPrivateKey);
return new JcaX509CRLConverter().getCRL(builder.build(signer));

代码示例来源:origin: org.xipki.scep/scep-server-emulator

public synchronized CertificateList getCrl(X500Name issuer, BigInteger serialNumber)
  throws Exception {
 if (crl != null) {
  return crl;
 }
 Date thisUpdate = new Date();
 X509v2CRLBuilder crlBuilder = new X509v2CRLBuilder(caSubject, thisUpdate);
 Date nextUpdate = new Date(thisUpdate.getTime() + 30 * DAY_IN_MS);
 crlBuilder.setNextUpdate(nextUpdate);
 Date caStartTime = caCert.getTBSCertificate().getStartDate().getDate();
 Date revocationTime = new Date(caStartTime.getTime() + 1);
 if (revocationTime.after(thisUpdate)) {
  revocationTime = caStartTime;
 }
 crlBuilder.addCRLEntry(BigInteger.valueOf(2), revocationTime, CRLReason.keyCompromise);
 crlBuilder.addExtension(Extension.cRLNumber, false, new ASN1Integer(crlNumber.getAndAdd(1)));
 String signatureAlgorithm = ScepUtil.getSignatureAlgorithm(caKey, ScepHashAlgo.SHA256);
 ContentSigner contentSigner = new JcaContentSignerBuilder(signatureAlgorithm).build(caKey);
 X509CRLHolder crl = crlBuilder.build(contentSigner);
 return crl.toASN1Structure();
}

代码示例来源:origin: puppetlabs/certificate-authority

X509v2CRLBuilder builder =
  new JcaX509v2CRLBuilder(crl.getIssuerX500Principal(), thisUpdate);
builder.setNextUpdate(nextUpdate);
builder.addCRL(new JcaX509CRLHolder(crl));
builder.addCRLEntry(serial, now.toDate(), 1);
builder.addExtension(Extension.cRLNumber, false,
           new CRLNumber(crlNumber.add(BigInteger.ONE)));
builder.addExtension(Extension.authorityKeyIdentifier, false,
           new AuthorityKeyIdentifierStructure(issuerPublicKey));
  new JcaContentSignerBuilder("SHA256withRSA").build(issuerPrivateKey);
return new JcaX509CRLConverter().getCRL(builder.build(signer));

代码示例来源:origin: puppetlabs/ssl-utils

X509v2CRLBuilder builder =
  new JcaX509v2CRLBuilder(crl.getIssuerX500Principal(), thisUpdate);
builder.setNextUpdate(nextUpdate);
builder.addCRL(new JcaX509CRLHolder(crl));
builder.addCRLEntry(serial, now.toDate(), 1);
builder.addExtension(Extension.cRLNumber, false,
           new CRLNumber(crlNumber.add(BigInteger.ONE)));
builder.addExtension(Extension.authorityKeyIdentifier, false,
           new JcaX509ExtensionUtils().createAuthorityKeyIdentifier(issuerPublicKey));
  new JcaContentSignerBuilder("SHA256withRSA").build(issuerPrivateKey);
return new JcaX509CRLConverter().getCRL(builder.build(signer));

代码示例来源:origin: org.xipki/ca-server

X509v2CRLBuilder crlBuilder = new X509v2CRLBuilder(crlIssuer, thisUpdate);
if (nextUpdate != null) {
 crlBuilder.setNextUpdate(nextUpdate);
   crlBuilder.addCRLEntry(serial, revocationTime, reason.getCode(),
     invalidityTime);
  } else {
   crlBuilder.addCRLEntry(serial, revocationTime, reason.getCode());
 crlBuilder.addCRLEntry(serial, revocationTime,
   new Extensions(extensions.toArray(new Extension[0])));
 isFirstCrlEntry = false;
   : pci.getSubjectKeyIdentifer();
 AuthorityKeyIdentifier aki = new AuthorityKeyIdentifier(akiValues);
 crlBuilder.addExtension(Extension.authorityKeyIdentifier, false, aki);
 crlBuilder.addExtension(Extension.cRLNumber, false, new ASN1Integer(crlNumber));
  crlBuilder.addExtension(Extension.issuingDistributionPoint, true, idp);
  CRLDistPoint cdp = CaUtil.createCrlDistributionPoints(deltaCrlUris, pci.getX500Subject(),
    crlIssuer);
  crlBuilder.addExtension(Extension.freshestCRL, false, cdp);
 crlHolder = crlBuilder.build(signer0.value());
} finally {
 concurrentSigner.requiteSigner(signer0);

相关文章