PaillierKeyGenerator { public PaillierKeyPair generate() { final SecureRandom random = new SecureRandom(); final BigInteger p = BigInteger.probablePrime(this.keyLength / 2, random); final BigInteger q = BigInteger.probablePrime(this.keyLength / 2, random); final BigInteger n = p.multiply(q); final BigInteger nSquared = n.multiply(n); final BigInteger pMinusOne = p.subtract(BigInteger.ONE); final BigInteger qMinusOne = q.subtract(BigInteger.ONE); final BigInteger lambda = pMinusOne.multiply(qMinusOne); final BigInteger g = n.add(BigInteger.ONE); final BigInteger mu = lambda.modInverse(n); final PaillierPublicKey publicKey = new PaillierPublicKey(n, g, nSquared); final PaillierPrivateKey privateKey = new PaillierPrivateKey(lambda, mu, n, nSquared); return new PaillierKeyPair(publicKey, privateKey); } PaillierKeyGenerator();  PaillierKeyGenerator(final int keyLength); PaillierKeyPair generate(); static final int DEFAULT_KEY_LEN; }
@Test public void testGenerate() { fail("Not yet implemented"); }