protected Signer makeSigner(SignatureAndHashAlgorithm algorithm, boolean raw, boolean forSigning, CipherParameters cp) { if ((algorithm != null) != TlsUtils.isTLSv12(context)) { throw new IllegalStateException(); } if (algorithm != null && algorithm.getSignature() != getSignatureAlgorithm()) { throw new IllegalStateException(); } short hashAlgorithm = algorithm == null ? HashAlgorithm.sha1 : algorithm.getHash(); Digest d = raw ? new NullDigest() : TlsUtils.createHash(hashAlgorithm); Signer s = new DSADigestSigner(createDSAImpl(hashAlgorithm), d); s.init(forSigning, makeInitParameters(forSigning, cp)); return s; }
protected Signer makeSigner(SignatureAndHashAlgorithm algorithm, boolean raw, boolean forSigning, CipherParameters cp) { if ((algorithm != null) != TlsUtils.isTLSv12(context)) { throw new IllegalStateException(); } if (algorithm != null && (algorithm.getHash() != HashAlgorithm.sha1 || algorithm.getSignature() != getSignatureAlgorithm())) { throw new IllegalStateException(); } Digest d = raw ? new NullDigest() : TlsUtils.createHash(HashAlgorithm.sha1); Signer s = new DSADigestSigner(createDSAImpl(), d); s.init(forSigning, cp); return s; }
public byte[] generateRawSignature(AsymmetricKeyParameter privateKey, byte[] md5AndSha1) throws CryptoException { // Note: Only use the SHA1 part of the hash Signer signer = makeSigner(new NullDigest(), true, new ParametersWithRandom(privateKey, this.context.getSecureRandom())); signer.update(md5AndSha1, 16, 20); return signer.generateSignature(); }
public boolean verifyRawSignature(byte[] sigBytes, AsymmetricKeyParameter publicKey, byte[] md5AndSha1) throws CryptoException { // Note: Only use the SHA1 part of the hash Signer signer = makeSigner(new NullDigest(), false, publicKey); signer.update(md5AndSha1, 16, 20); return signer.verifySignature(sigBytes); }
@Override protected Signer makeSigner(SignatureAndHashAlgorithm signatureAndHashAlgorithm, boolean raw, boolean forSigning, CipherParameters cipherParameters) { if (!TlsUtils.isTLSv12(context)) { throw new IllegalStateException("Impossible"); } Digest d = raw ? new NullDigest() : TlsUtils.createHash(HashAlgorithm.sha256); Signer s = new DSADigestSigner(createDSAImpl(HashAlgorithm.sha256), d); s.init(forSigning, makeInitParameters(forSigning, cipherParameters)); return s; }
public byte[] calculateRawSignature(AsymmetricKeyParameter privateKey, byte[] md5andsha1) throws CryptoException { // Note: Only use the SHA1 part of the hash Signer sig = new DSADigestSigner(new DSASigner(), new NullDigest()); sig.init(true, privateKey); sig.update(md5andsha1, 16, 20); return sig.generateSignature(); }
public byte[] calculateRawSignature(AsymmetricKeyParameter privateKey, byte[] md5andsha1) throws CryptoException { Signer sig = new GenericSigner(new PKCS1Encoding(new RSABlindedEngine()), new NullDigest()); sig.init(true, privateKey); sig.update(md5andsha1, 0, md5andsha1.length); return sig.generateSignature(); }
public noneDSA() { super(new NullDigest(), new org.bouncycastle.crypto.signers.DSASigner()); }
public noneRSA() { super(new NullDigest(), new PKCS1Encoding(new RSABlindedEngine())); }
public ecDSAnone() { super(new NullDigest(), new ECDSASigner(), new StdDSAEncoder()); }
public NoneRSA() { super(new NullDigest()); }