Top Description Fields Constructors Methods
org.bouncycastle.crypto.generators

public Class NaccacheSternKeyPairGenerator

extends Object
implements AsymmetricCipherKeyPairGenerator
Class Inheritance
All Implemented Interfaces
org.bouncycastle.crypto.AsymmetricCipherKeyPairGenerator
Imports
java.math.BigInteger, java.security.SecureRandom, java.util.Vector, org.bouncycastle.crypto.AsymmetricCipherKeyPair, .AsymmetricCipherKeyPairGenerator, .CryptoServicePurpose, .CryptoServicesRegistrar, .KeyGenerationParameters, org.bouncycastle.crypto.constraints.ConstraintUtils, .DefaultServiceProperties, org.bouncycastle.crypto.params.NaccacheSternKeyGenerationParameters, .NaccacheSternKeyParameters, .NaccacheSternPrivateKeyParameters, org.bouncycastle.util.BigIntegers

Key generation parameters for NaccacheStern cipher. For details on this cipher, please see https://www.gemplus.com/smart/rd/publications/pdf/NS98pkcs.pdf

Field Summary

Modifier and TypeField and Description
private static final BigInteger
private NaccacheSternKeyGenerationParameters
private static int[]

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private static Vector<E>

Returns:

a vector containing the found primes as Integer
findFirstPrimes
(int
the number of primes to find
count
)

Finds the first 'count' primes starting with 3

public AsymmetricCipherKeyPair
generateKeyPair()

Implements org.bouncycastle.crypto.AsymmetricCipherKeyPairGenerator.generateKeyPair.

return an AsymmetricCipherKeyPair containing the generated keys.

private static BigInteger
generatePrime(int bitLength, int certainty, SecureRandom rand)

private static int
getInt(SecureRandom rand, int n)

public void
init(KeyGenerationParameters
the parameters the key pair is to be initialised with.
param
)

Implements org.bouncycastle.crypto.AsymmetricCipherKeyPairGenerator.init.

intialise the key pair generator.

private static Vector<E>

Returns:

a new ArrayList with the permuted elements.
permuteList
(Vector<E>
the ArrayList to be permuted
arr
,
SecureRandom
the source of Randomness for permutation
rand
)

Generates a permuted ArrayList from the original one.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

ONEback to summary
private static final BigInteger ONE
paramback to summary
private NaccacheSternKeyGenerationParameters param
smallPrimesback to summary
private static int[] smallPrimes

Constructor Detail

NaccacheSternKeyPairGeneratorback to summary
public NaccacheSternKeyPairGenerator()

Method Detail

findFirstPrimesback to summary
private static Vector<E> findFirstPrimes(int count)

Finds the first 'count' primes starting with 3

Parameters
count:int

the number of primes to find

Returns:Vector<E>

a vector containing the found primes as Integer

generateKeyPairback to summary
public AsymmetricCipherKeyPair generateKeyPair()

Implements org.bouncycastle.crypto.AsymmetricCipherKeyPairGenerator.generateKeyPair.

Doc from org.bouncycastle.crypto.AsymmetricCipherKeyPairGenerator.generateKeyPair.

return an AsymmetricCipherKeyPair containing the generated keys.

Returns:AsymmetricCipherKeyPair

an AsymmetricCipherKeyPair containing the generated keys.

generatePrimeback to summary
private static BigInteger generatePrime(int bitLength, int certainty, SecureRandom rand)
getIntback to summary
private static int getInt(SecureRandom rand, int n)
initback to summary
public void init(KeyGenerationParameters param)

Implements org.bouncycastle.crypto.AsymmetricCipherKeyPairGenerator.init.

Doc from org.bouncycastle.crypto.AsymmetricCipherKeyPairGenerator.init.

intialise the key pair generator.

Parameters
param:KeyGenerationParameters

the parameters the key pair is to be initialised with.

permuteListback to summary
private static Vector<E> permuteList(Vector<E> arr, SecureRandom rand)

Generates a permuted ArrayList from the original one. The original List is not modified

Parameters
arr:Vector<E>

the ArrayList to be permuted

rand:SecureRandom

the source of Randomness for permutation

Returns:Vector<E>

a new ArrayList with the permuted elements.