public class NaccacheSternKeyPairGenerator extends java.lang.Object implements AsymmetricCipherKeyPairGenerator
Modifier and Type | Field and Description |
---|---|
private static java.math.BigInteger |
ONE |
private NaccacheSternKeyGenerationParameters |
param |
private static int[] |
smallPrimes |
Constructor and Description |
---|
NaccacheSternKeyPairGenerator() |
Modifier and Type | Method and Description |
---|---|
private static java.util.Vector |
findFirstPrimes(int count)
Finds the first 'count' primes starting with 3
|
AsymmetricCipherKeyPair |
generateKeyPair()
return an AsymmetricCipherKeyPair containing the generated keys.
|
private static java.math.BigInteger |
generatePrime(int bitLength,
int certainty,
java.security.SecureRandom rand) |
private static int |
getInt(java.security.SecureRandom rand,
int n) |
void |
init(KeyGenerationParameters param)
intialise the key pair generator.
|
private static java.util.Vector |
permuteList(java.util.Vector arr,
java.security.SecureRandom rand)
Generates a permuted ArrayList from the original one.
|
private static int[] smallPrimes
private NaccacheSternKeyGenerationParameters param
private static final java.math.BigInteger ONE
public void init(KeyGenerationParameters param)
AsymmetricCipherKeyPairGenerator
init
in interface AsymmetricCipherKeyPairGenerator
param
- the parameters the key pair is to be initialised with.public AsymmetricCipherKeyPair generateKeyPair()
AsymmetricCipherKeyPairGenerator
generateKeyPair
in interface AsymmetricCipherKeyPairGenerator
private static java.math.BigInteger generatePrime(int bitLength, int certainty, java.security.SecureRandom rand)
private static java.util.Vector permuteList(java.util.Vector arr, java.security.SecureRandom rand)
arr
- the ArrayList to be permutedrand
- the source of Randomness for permutationprivate static int getInt(java.security.SecureRandom rand, int n)
private static java.util.Vector findFirstPrimes(int count)
count
- the number of primes to find