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


Java CMSSignedDataGenerator.addCRL方法代码示例

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


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

示例1: getCrl

import org.bouncycastle.cms.CMSSignedDataGenerator; //导入方法依赖的package包/类
private SignedData getCrl(X509Ca ca, BigInteger serialNumber)
        throws FailInfoException, OperationException {
    if (!control.supportGetCrl()) {
        throw FailInfoException.BAD_REQUEST;
    }

    CertificateList crl = ca.getBcCurrentCrl();
    if (crl == null) {
        throw FailInfoException.BAD_REQUEST;
    }
    CMSSignedDataGenerator cmsSignedDataGen = new CMSSignedDataGenerator();
    cmsSignedDataGen.addCRL(new X509CRLHolder(crl));

    CMSSignedData signedData;
    try {
        signedData = cmsSignedDataGen.generate(new CMSAbsentContent());
    } catch (CMSException ex) {
        LogUtil.error(LOG, ex, "could not generate CMSSignedData");
        throw new OperationException(ErrorCode.SYSTEM_FAILURE, ex);
    }
    return SignedData.getInstance(signedData.toASN1Structure().getContent());
}
 
开发者ID:xipki,项目名称:xipki,代码行数:23,代码来源:ScepImpl.java

示例2: sign

import org.bouncycastle.cms.CMSSignedDataGenerator; //导入方法依赖的package包/类
public byte[] sign(InputStream content) {
	CMSSignedDataGenerator gen = new CMSSignedDataGenerator();
	// CertificateChain
	List<Certificate> certList = Arrays.asList(certChain);

	try {
		CertStore certStore = CertStore.getInstance("Collection", new CollectionCertStoreParameters(certList),
				provider);

		Hashtable signedAttrs = new Hashtable();
		X509Certificate signingCert = (X509Certificate) certList.get(0);
		gen.addSignerInfoGenerator(new JcaSimpleSignerInfoGeneratorBuilder().setProvider("BC")
				.setSignedAttributeGenerator(new AttributeTable(signedAttrs))
				.build("SHA256withRSA", privKey, signingCert));

		gen.addCertificates(new JcaCertStore(certList));
		// gen.addCRLs(new JcaCRLStore(certStore.getCRLs(null)));
		boolean embedCrls = true;
		if (embedCrls) {
			X509CRL[] crls = fetchCRLs(signingCert);
			for (X509CRL crl : crls) {
				gen.addCRL(new JcaX509CRLHolder(crl));
			}
		}
		// gen.addOtherRevocationInfo(arg0, arg1);

		CMSProcessableByteArray processable = new CMSProcessableByteArray(IOUtils.toByteArray(content));

		CMSSignedData signedData = gen.generate(processable, false);
		if (tsaClient != null) {
			signedData = signTimeStamps(signedData);
		}
		return signedData.getEncoded();
	} catch (Exception e) {
		new RuntimeException(e);
	}
	throw new RuntimeException("Problem while preparing signature");

}
 
开发者ID:beat2,项目名称:pdfbox-signer,代码行数:40,代码来源:Signing.java


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