本文整理汇总了Java中org.bouncycastle.operator.jcajce.JcaDigestCalculatorProviderBuilder.build方法的典型用法代码示例。如果您正苦于以下问题:Java JcaDigestCalculatorProviderBuilder.build方法的具体用法?Java JcaDigestCalculatorProviderBuilder.build怎么用?Java JcaDigestCalculatorProviderBuilder.build使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bouncycastle.operator.jcajce.JcaDigestCalculatorProviderBuilder
的用法示例。
在下文中一共展示了JcaDigestCalculatorProviderBuilder.build方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: generateOCSPRequest
import org.bouncycastle.operator.jcajce.JcaDigestCalculatorProviderBuilder; //导入方法依赖的package包/类
/**
* Generates an OCSP request using BouncyCastle.
* @param issuerCert certificate of the issues
* @param serialNumber serial number
* @return an OCSP request
* @throws OCSPException
* @throws IOException
*/
private static OCSPReq generateOCSPRequest(X509Certificate issuerCert, BigInteger serialNumber) throws OCSPException, IOException, OperatorException, CertificateEncodingException {
//Add provider BC
Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
JcaDigestCalculatorProviderBuilder digestCalculatorProviderBuilder = new JcaDigestCalculatorProviderBuilder();
DigestCalculatorProvider digestCalculatorProvider = digestCalculatorProviderBuilder.build();
DigestCalculator digestCalculator = digestCalculatorProvider.get(CertificateID.HASH_SHA1);
// Generate the id for the certificate we are looking for
CertificateID id = new CertificateID(digestCalculator, new JcaX509CertificateHolder(issuerCert), serialNumber);
// basic request generation with nonce
OCSPReqBuilder gen = new OCSPReqBuilder();
gen.addRequest(id);
// create details for nonce extension
Extension ext = new Extension(OCSPObjectIdentifiers.id_pkix_ocsp_nonce, false, new DEROctetString(new DEROctetString(PdfEncryption.createDocumentId()).getEncoded()));
gen.setRequestExtensions(new Extensions(new Extension[]{ext}));
return gen.build();
}
示例2: createSignerInfoGenerator
import org.bouncycastle.operator.jcajce.JcaDigestCalculatorProviderBuilder; //导入方法依赖的package包/类
private SignerInfoGenerator createSignerInfoGenerator()
{
try
{
ContentSigner sha1Signer = createContentSigner();
JcaDigestCalculatorProviderBuilder digestProviderBuilder = new JcaDigestCalculatorProviderBuilder().setProvider("BC");
JcaSignerInfoGeneratorBuilder signerInfoGeneratorBuilder = new JcaSignerInfoGeneratorBuilder(
digestProviderBuilder.build());
return signerInfoGeneratorBuilder.build(sha1Signer, signerCertificate);
}
catch (CertificateException | OperatorCreationException e)
{
throw YonaException.unexpected(e);
}
}
示例3: getSHA1DigestCalculator
import org.bouncycastle.operator.jcajce.JcaDigestCalculatorProviderBuilder; //导入方法依赖的package包/类
public static DigestCalculator getSHA1DigestCalculator() throws DSSException {
try {
JcaDigestCalculatorProviderBuilder jcaDigestCalculatorProviderBuilder = new JcaDigestCalculatorProviderBuilder();
jcaDigestCalculatorProviderBuilder.setProvider("BC");
final DigestCalculatorProvider digestCalculatorProvider = jcaDigestCalculatorProviderBuilder.build();
final DigestCalculator digestCalculator = digestCalculatorProvider.get(CertificateID.HASH_SHA1);
return digestCalculator;
} catch (OperatorCreationException e) {
throw new DSSException(e);
}
}