KeyGenerator: Check that dsax is greater than zero

This commit is contained in:
zzz
2016-01-27 13:42:58 +00:00
parent 6ab814a649
commit d2d5a464a3

View File

@ -208,10 +208,10 @@ public final class KeyGenerator {
SimpleDataStructure[] keys = new SimpleDataStructure[2];
BigInteger x = null;
// make sure the random key is less than the DSA q
// make sure the random key is less than the DSA q and greater than zero
do {
x = new NativeBigInteger(160, _context.random());
} while (x.compareTo(CryptoConstants.dsaq) >= 0);
} while (x.compareTo(CryptoConstants.dsaq) >= 0 || x.equals(BigInteger.ZERO));
BigInteger y = CryptoConstants.dsag.modPow(x, CryptoConstants.dsap);
keys[0] = new SigningPublicKey();