org.spongycastle.cms.bc.BcRSASignerInfoVerifierBuilder Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scprov-jdk15 Show documentation
Show all versions of scprov-jdk15 Show documentation
Spongy Castle is a package-rename (org.bouncycastle.* to org.spongycastle.*) of Bouncy Castle intended for Android.
Android ships with a stripped-down version of Bouncy Castle - this causes classloader collisions if you try to add
an alternative (updated/complete) Bouncy Castle jar.
This jar contains JCE provider and lightweight API for the Bouncy Castle Cryptography APIs for JDK 1.5.
The newest version!
package org.spongycastle.cms.bc;
import java.security.cert.CertificateException;
import org.spongycastle.cert.X509CertificateHolder;
import org.spongycastle.cms.SignerInformationVerifier;
import org.spongycastle.crypto.params.AsymmetricKeyParameter;
import org.spongycastle.operator.DigestAlgorithmIdentifierFinder;
import org.spongycastle.operator.DigestCalculatorProvider;
import org.spongycastle.operator.OperatorCreationException;
import org.spongycastle.operator.bc.BcRSAContentVerifierProviderBuilder;
public class BcRSASignerInfoVerifierBuilder
{
private BcRSAContentVerifierProviderBuilder contentVerifierProviderBuilder;
private DigestCalculatorProvider digestCalculatorProvider;
public BcRSASignerInfoVerifierBuilder(DigestAlgorithmIdentifierFinder digestAlgorithmFinder, DigestCalculatorProvider digestCalculatorProvider)
{
this.contentVerifierProviderBuilder = new BcRSAContentVerifierProviderBuilder(digestAlgorithmFinder);
this.digestCalculatorProvider = digestCalculatorProvider;
}
public SignerInformationVerifier build(X509CertificateHolder certHolder)
throws OperatorCreationException, CertificateException
{
return new SignerInformationVerifier(contentVerifierProviderBuilder.build(certHolder), digestCalculatorProvider);
}
public SignerInformationVerifier build(AsymmetricKeyParameter pubKey)
throws OperatorCreationException
{
return new SignerInformationVerifier(contentVerifierProviderBuilder.build(pubKey), digestCalculatorProvider);
}
}