org.testifyproject.bouncycastle.operator.bc.BcRSAContentVerifierProviderBuilder Maven / Gradle / Ivy
The newest version!
package org.testifyproject.bouncycastle.operator.bc;
import java.io.IOException;
import org.testifyproject.bouncycastle.asn1.x509.AlgorithmIdentifier;
import org.testifyproject.bouncycastle.asn1.x509.SubjectPublicKeyInfo;
import org.testifyproject.bouncycastle.crypto.Digest;
import org.testifyproject.bouncycastle.crypto.Signer;
import org.testifyproject.bouncycastle.crypto.params.AsymmetricKeyParameter;
import org.testifyproject.bouncycastle.crypto.signers.RSADigestSigner;
import org.testifyproject.bouncycastle.crypto.util.PublicKeyFactory;
import org.testifyproject.bouncycastle.operator.DigestAlgorithmIdentifierFinder;
import org.testifyproject.bouncycastle.operator.OperatorCreationException;
public class BcRSAContentVerifierProviderBuilder
extends BcContentVerifierProviderBuilder
{
private DigestAlgorithmIdentifierFinder digestAlgorithmFinder;
public BcRSAContentVerifierProviderBuilder(DigestAlgorithmIdentifierFinder digestAlgorithmFinder)
{
this.digestAlgorithmFinder = digestAlgorithmFinder;
}
protected Signer createSigner(AlgorithmIdentifier sigAlgId)
throws OperatorCreationException
{
AlgorithmIdentifier digAlg = digestAlgorithmFinder.find(sigAlgId);
Digest dig = digestProvider.get(digAlg);
return new RSADigestSigner(dig);
}
protected AsymmetricKeyParameter extractKeyParameters(SubjectPublicKeyInfo publicKeyInfo)
throws IOException
{
return PublicKeyFactory.createKey(publicKeyInfo);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy