Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

gnu.java.security.key.dss
Class FIPS186  view FIPS186 download FIPS186.java

java.lang.Object
  extended bygnu.java.security.key.dss.FIPS186

public class FIPS186
extends java.lang.Object

An implementation of the DSA parameters generation as described in FIPS-186.

References:
Digital Signature Standard (DSS), Federal Information Processing Standards Publication 186. National Institute of Standards and Technology.


Field Summary
static int DSA_PARAMS_COUNTER
           
static int DSA_PARAMS_E
           
static int DSA_PARAMS_G
           
static int DSA_PARAMS_P
           
static int DSA_PARAMS_Q
           
static int DSA_PARAMS_SEED
           
private  int L
          The length of the modulus of DSS keys generated by this instance.
private  gnu.java.security.util.PRNG prng
          Our default source of randomness.
private  java.security.SecureRandom rnd
          The optional java.security.SecureRandom instance to use.
private  gnu.java.security.hash.Sha160 sha
          The SHA instance to use.
private static java.math.BigInteger TWO
          The BigInteger constant 2.
private static java.math.BigInteger TWO_POW_160
           
 
Constructor Summary
FIPS186(int L, java.security.SecureRandom rnd)
           
 
Method Summary
 java.math.BigInteger[] generateParameters()
          This method generates the DSS p, q, and g parameters only when L (the modulus length) is not one of the following: 512, 768 and 1024.
private  gnu.java.security.util.PRNG getDefaultPRNG()
           
private  void nextRandomBytes(byte[] buffer)
          Fills the designated byte array with random data.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DSA_PARAMS_SEED

public static final int DSA_PARAMS_SEED
See Also:
Constant Field Values

DSA_PARAMS_COUNTER

public static final int DSA_PARAMS_COUNTER
See Also:
Constant Field Values

DSA_PARAMS_Q

public static final int DSA_PARAMS_Q
See Also:
Constant Field Values

DSA_PARAMS_P

public static final int DSA_PARAMS_P
See Also:
Constant Field Values

DSA_PARAMS_E

public static final int DSA_PARAMS_E
See Also:
Constant Field Values

DSA_PARAMS_G

public static final int DSA_PARAMS_G
See Also:
Constant Field Values

TWO

private static final java.math.BigInteger TWO
The BigInteger constant 2.


TWO_POW_160

private static final java.math.BigInteger TWO_POW_160

sha

private gnu.java.security.hash.Sha160 sha
The SHA instance to use.


L

private int L
The length of the modulus of DSS keys generated by this instance.


rnd

private java.security.SecureRandom rnd
The optional java.security.SecureRandom instance to use.


prng

private gnu.java.security.util.PRNG prng
Our default source of randomness.

Constructor Detail

FIPS186

public FIPS186(int L,
               java.security.SecureRandom rnd)
Method Detail

generateParameters

public java.math.BigInteger[] generateParameters()
This method generates the DSS p, q, and g parameters only when L (the modulus length) is not one of the following: 512, 768 and 1024. For those values of L, this implementation uses pre-computed values of p, q, and g given in the document CryptoSpec included in the security guide documentation of the standard JDK distribution.

The DSS requires two primes , p and q, satisfying the following three conditions:

  • 2159 < q < 2160
  • 2L-1 < p < 2L for a specified L, where L = 512 + 64j for some 0 <= j <= 8
  • q divides p - 1.
The algorithm used to find these primes is as described in FIPS-186, section 2.2: GENERATION OF PRIMES. This prime generation scheme starts by using the gnu.java.security.hash.Sha160 and a user supplied SEED to construct a prime, q, in the range 2159 < q < 2160. Once this is accomplished, the same SEED value is used to construct an X in the range 2L-1 < X < 2L. The prime, p, is then formed by rounding X to a number congruent to 1 mod 2q. In this implementation we use the same SEED value given in FIPS-186, Appendix 5.


nextRandomBytes

private void nextRandomBytes(byte[] buffer)
Fills the designated byte array with random data.


getDefaultPRNG

private gnu.java.security.util.PRNG getDefaultPRNG()