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