From d2d5a464a33ac7f31db5cc082a713c794f65f577 Mon Sep 17 00:00:00 2001 From: zzz Date: Wed, 27 Jan 2016 13:42:58 +0000 Subject: [PATCH] KeyGenerator: Check that dsax is greater than zero --- core/java/src/net/i2p/crypto/KeyGenerator.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/core/java/src/net/i2p/crypto/KeyGenerator.java b/core/java/src/net/i2p/crypto/KeyGenerator.java index 6c8b7ec48..957b6120a 100644 --- a/core/java/src/net/i2p/crypto/KeyGenerator.java +++ b/core/java/src/net/i2p/crypto/KeyGenerator.java @@ -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();