com.fitbur.bouncycastle.cms.bc.BcRSASignerInfoVerifierBuilder Maven / Gradle / Ivy
package com.fitbur.bouncycastle.cms.bc;
import com.fitbur.bouncycastle.cert.X509CertificateHolder;
import com.fitbur.bouncycastle.cms.CMSSignatureAlgorithmNameGenerator;
import com.fitbur.bouncycastle.cms.SignerInformationVerifier;
import com.fitbur.bouncycastle.crypto.params.AsymmetricKeyParameter;
import com.fitbur.bouncycastle.operator.DigestAlgorithmIdentifierFinder;
import com.fitbur.bouncycastle.operator.DigestCalculatorProvider;
import com.fitbur.bouncycastle.operator.OperatorCreationException;
import com.fitbur.bouncycastle.operator.SignatureAlgorithmIdentifierFinder;
import com.fitbur.bouncycastle.operator.bc.BcRSAContentVerifierProviderBuilder;
public class BcRSASignerInfoVerifierBuilder
{
private BcRSAContentVerifierProviderBuilder contentVerifierProviderBuilder;
private DigestCalculatorProvider digestCalculatorProvider;
private CMSSignatureAlgorithmNameGenerator sigAlgNameGen;
private SignatureAlgorithmIdentifierFinder sigAlgIdFinder;
public BcRSASignerInfoVerifierBuilder(CMSSignatureAlgorithmNameGenerator sigAlgNameGen, SignatureAlgorithmIdentifierFinder sigAlgIdFinder, DigestAlgorithmIdentifierFinder digestAlgorithmFinder, DigestCalculatorProvider digestCalculatorProvider)
{
this.sigAlgNameGen = sigAlgNameGen;
this.sigAlgIdFinder = sigAlgIdFinder;
this.contentVerifierProviderBuilder = new BcRSAContentVerifierProviderBuilder(digestAlgorithmFinder);
this.digestCalculatorProvider = digestCalculatorProvider;
}
public SignerInformationVerifier build(X509CertificateHolder certHolder)
throws OperatorCreationException
{
return new SignerInformationVerifier(sigAlgNameGen, sigAlgIdFinder, contentVerifierProviderBuilder.build(certHolder), digestCalculatorProvider);
}
public SignerInformationVerifier build(AsymmetricKeyParameter pubKey)
throws OperatorCreationException
{
return new SignerInformationVerifier(sigAlgNameGen, sigAlgIdFinder, contentVerifierProviderBuilder.build(pubKey), digestCalculatorProvider);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy