Class DSAParametersGenerator
java.lang.Object
org.gudy.bouncycastle.crypto.generators.DSAParametersGenerator
generate suitable parameters for DSA, in line with FIPS 186-2.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate intprivate static BigIntegerprivate SecureRandomprivate intprivate static BigInteger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidadd(byte[] a, byte[] b, int value) add value to b, returning the result in a.which generates the p and g values from the given parameters, returning the DSAParameters object.voidinit(int size, int certainty, SecureRandom random) initialise the key generator.
-
Field Details
-
size
private int size -
certainty
private int certainty -
random
-
ONE
-
TWO
-
-
Constructor Details
-
DSAParametersGenerator
public DSAParametersGenerator()
-
-
Method Details
-
init
initialise the key generator.- Parameters:
size- size of the key (range 2^512 -> 2^1024 - 64 bit increments)certainty- measure of robustness of prime (for FIPS 186-2 compliance this should be at least 80).random- random byte source.
-
add
private void add(byte[] a, byte[] b, int value) add value to b, returning the result in a. The a value is treated as a BigInteger of length (a.length * 8) bits. The result is modulo 2^a.length in case of overflow. -
generateParameters
which generates the p and g values from the given parameters, returning the DSAParameters object.Note: can take a while...
-