org.bouncycastle.cert.X509v2CRLBuilder.addExtension()方法的使用及代码示例

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

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

X509v2CRLBuilder.addExtension介绍

暂无

代码示例

代码示例来源: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: 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(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);

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

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);

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

ExtensionsUtils.getExtensionValue(crl, ExtensionsUtils.CRL_NUMBER_OID);
crlNumber = (crlNumber == null) ? BigInteger.ZERO : crlNumber;
builder.addExtension(Extension.cRLNumber, false,
           new CRLNumber(crlNumber.add(BigInteger.ONE)));
builder.addExtension(Extension.authorityKeyIdentifier, false,
           new AuthorityKeyIdentifierStructure(issuerPublicKey));

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

ExtensionsUtils.getExtensionValue(crl, ExtensionsUtils.CRL_NUMBER_OID);
crlNumber = (crlNumber == null) ? BigInteger.ZERO : crlNumber;
builder.addExtension(Extension.cRLNumber, false,
           new CRLNumber(crlNumber.add(BigInteger.ONE)));
builder.addExtension(Extension.authorityKeyIdentifier, false,
           new JcaX509ExtensionUtils().createAuthorityKeyIdentifier(issuerPublicKey));

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

: 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);

代码示例来源: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());

相关文章