当前位置: 首页>>代码示例>>Java>>正文


Java X509v2CRLBuilder.setNextUpdate方法代码示例

本文整理汇总了Java中org.bouncycastle.cert.X509v2CRLBuilder.setNextUpdate方法的典型用法代码示例。如果您正苦于以下问题:Java X509v2CRLBuilder.setNextUpdate方法的具体用法?Java X509v2CRLBuilder.setNextUpdate怎么用?Java X509v2CRLBuilder.setNextUpdate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.bouncycastle.cert.X509v2CRLBuilder的用法示例。


在下文中一共展示了X509v2CRLBuilder.setNextUpdate方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: generateCRL

import org.bouncycastle.cert.X509v2CRLBuilder; //导入方法依赖的package包/类
private File generateCRL(X509Certificate cert) throws CRLException, NoSuchAlgorithmException, SignatureException, InvalidKeyException, IOException, OperatorCreationException {
    X500Name issuer = new X500Name("CN=ca");
    Date thisUpdate = new Date();
    X509v2CRLBuilder gen = new X509v2CRLBuilder(issuer, thisUpdate);
    gen.setNextUpdate(new Date(System.currentTimeMillis() + 60000));

    if (cert != null) {
        gen.addCRLEntry(cert.getSerialNumber(), new Date(System.currentTimeMillis() - 1000), CRLReason.keyCompromise);
    }

    ContentSigner sigGen = new JcaContentSignerBuilder("SHA1withRSA").setProvider("BC").build(credential.getPrivateKey());
    X509CRLHolder crl = gen.build(sigGen);

    final File crlFile = File.createTempFile("test", "test");
    crlFile.deleteOnExit();
    FileOutputStream fos = new FileOutputStream(crlFile);
    IOUtils.write(crl.getEncoded(), fos);
    fos.close();
    return crlFile;
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:21,代码来源:IntegrationTests.java

示例2: generateCRL

import org.bouncycastle.cert.X509v2CRLBuilder; //导入方法依赖的package包/类
private File generateCRL(X509Certificate cert) throws CRLException, NoSuchAlgorithmException, SignatureException, InvalidKeyException, IOException, OperatorCreationException {
       X500Name issuer = new X500Name("CN=ca");
       Date thisUpdate = new Date();
       X509v2CRLBuilder gen = new X509v2CRLBuilder(issuer, thisUpdate);
	gen.setNextUpdate(new Date(System.currentTimeMillis() + 60000));

       if (cert != null) {
		gen.addCRLEntry(cert.getSerialNumber(), new Date(System.currentTimeMillis() - 1000), CRLReason.keyCompromise);
	}

       ContentSigner sigGen = new JcaContentSignerBuilder("SHA1withRSA").setProvider("BC").build(cred.getPrivateKey());
	X509CRLHolder crl = gen.build(sigGen);

	final File crlFile = File.createTempFile("test", "test");
	crlFile.deleteOnExit();
	FileOutputStream fos = new FileOutputStream(crlFile);
	IOUtils.write(crl.getEncoded(), fos);
	fos.close();
	return crlFile;
}
 
开发者ID:amagdenko,项目名称:oiosaml.java,代码行数:21,代码来源:CRLCheckerTest.java

示例3: makeCrl

import org.bouncycastle.cert.X509v2CRLBuilder; //导入方法依赖的package包/类
public static X509CRL makeCrl(KeyPair pair)
    throws Exception
{
    Date                 now = new Date();
    X509v2CRLBuilder crlGen = new X509v2CRLBuilder(new X500Name("CN=Test CA"), now);
    JcaX509ExtensionUtils extensionUtils = new JcaX509ExtensionUtils();

    crlGen.setNextUpdate(new Date(now.getTime() + 100000));

    crlGen.addCRLEntry(BigInteger.ONE, now, CRLReason.privilegeWithdrawn);

    crlGen.addExtension(Extension.authorityKeyIdentifier, false, extensionUtils.createAuthorityKeyIdentifier(pair.getPublic()));

    return new JcaX509CRLConverter().setProvider("BC").getCRL(crlGen.build(new JcaContentSignerBuilder("SHA256WithRSAEncryption").setProvider("BC").build(pair.getPrivate())));
}
 
开发者ID:credentials,项目名称:irma_future_id,代码行数:16,代码来源:CMSTestUtil.java


注:本文中的org.bouncycastle.cert.X509v2CRLBuilder.setNextUpdate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。