diff options
Diffstat (limited to 'src/main/java/org/bouncycastle/crypto/tls/TlsDSASigner.java')
-rw-r--r-- | src/main/java/org/bouncycastle/crypto/tls/TlsDSASigner.java | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/main/java/org/bouncycastle/crypto/tls/TlsDSASigner.java b/src/main/java/org/bouncycastle/crypto/tls/TlsDSASigner.java index ea5a8572..b0e89572 100644 --- a/src/main/java/org/bouncycastle/crypto/tls/TlsDSASigner.java +++ b/src/main/java/org/bouncycastle/crypto/tls/TlsDSASigner.java @@ -11,9 +11,13 @@ import org.bouncycastle.crypto.params.AsymmetricKeyParameter; import org.bouncycastle.crypto.params.ParametersWithRandom; import org.bouncycastle.crypto.signers.DSADigestSigner; -public abstract class TlsDSASigner extends AbstractTlsSigner { +public abstract class TlsDSASigner + extends AbstractTlsSigner +{ - public byte[] generateRawSignature(AsymmetricKeyParameter privateKey, byte[] md5AndSha1) throws CryptoException { + public byte[] generateRawSignature(AsymmetricKeyParameter privateKey, byte[] md5AndSha1) + throws CryptoException + { // Note: Only use the SHA1 part of the hash Signer signer = makeSigner(new NullDigest(), true, @@ -23,7 +27,8 @@ public abstract class TlsDSASigner extends AbstractTlsSigner { } public boolean verifyRawSignature(byte[] sigBytes, AsymmetricKeyParameter publicKey, byte[] md5AndSha1) - throws CryptoException { + throws CryptoException + { // Note: Only use the SHA1 part of the hash Signer signer = makeSigner(new NullDigest(), false, publicKey); @@ -31,15 +36,18 @@ public abstract class TlsDSASigner extends AbstractTlsSigner { return signer.verifySignature(sigBytes); } - public Signer createSigner(AsymmetricKeyParameter privateKey) { + public Signer createSigner(AsymmetricKeyParameter privateKey) + { return makeSigner(new SHA1Digest(), true, new ParametersWithRandom(privateKey, this.context.getSecureRandom())); } - public Signer createVerifyer(AsymmetricKeyParameter publicKey) { + public Signer createVerifyer(AsymmetricKeyParameter publicKey) + { return makeSigner(new SHA1Digest(), false, publicKey); } - protected Signer makeSigner(Digest d, boolean forSigning, CipherParameters cp) { + protected Signer makeSigner(Digest d, boolean forSigning, CipherParameters cp) + { Signer s = new DSADigestSigner(createDSAImpl(), d); s.init(forSigning, cp); return s; |