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

Quick Search    Search Deep

gnu.javax.crypto.key.dh
Class GnuDHKeyPairGenerator  view GnuDHKeyPairGenerator download GnuDHKeyPairGenerator.java

java.lang.Object
  extended bygnu.javax.crypto.key.dh.GnuDHKeyPairGenerator
All Implemented Interfaces:
gnu.java.security.key.IKeyPairGenerator

public class GnuDHKeyPairGenerator
extends java.lang.Object
implements gnu.java.security.key.IKeyPairGenerator

An implementation of a Diffie-Hellman keypair generator.

Reference:

  1. Diffie-Hellman Key Agreement Method
    Eric Rescorla.


Field Summary
private  java.math.BigInteger counter
           
private static boolean DEBUG
           
private static int debuglevel
           
private static int DEFAULT_ENCODING_FORMAT
          Default encoding format to use when none was specified.
static int DEFAULT_EXPONENT_SIZE
          Default value for the size in bits of the private exponent (x).
static int DEFAULT_PRIME_SIZE
          Default value for the size in bits of the public prime (p).
static java.lang.String DH_PARAMETERS
          Property name of an optional javax.crypto.spec.DHGenParameterSpec or javax.crypto.spec.DHParameterSpec instance to use for this generator.
private static java.io.PrintWriter err
           
static java.lang.String EXPONENT_SIZE
          Property name of the size in bits (Integer) of the private exponent (x).
private  java.math.BigInteger g
           
private  java.math.BigInteger j
           
private  int l
          The desired size in bits of the public prime (p).
private  int m
          The desired size in bits of the private exponent (x).
private static java.lang.String NAME
           
private  java.math.BigInteger p
           
static java.lang.String PREFERRED_ENCODING_FORMAT
          Property name of the preferred encoding format to use when externalizing generated instance of key-pairs from this generator.
private  int preferredFormat
          Preferred encoding format of generated keys.
static java.lang.String PRIME_SIZE
          Property name of the size in bits (Integer) of the public prime (p).
private  gnu.java.security.util.PRNG prng
          Our default source of randomness.
private  java.math.BigInteger q
           
private  java.security.SecureRandom rnd
          The optional java.security.SecureRandom instance to use.
private  java.math.BigInteger seed
           
private  gnu.java.security.hash.Sha160 sha
          The SHA instance to use.
static java.lang.String SOURCE_OF_RANDOMNESS
          Property name of an optional java.security.SecureRandom instance to use.
 
Constructor Summary
GnuDHKeyPairGenerator()
           
 
Method Summary
private static void debug(java.lang.String s)
           
 java.security.KeyPair generate()
          Generates a new keypair based on the attributes used to configure the instance.
private  gnu.java.security.util.PRNG getDefaultPRNG()
           
 java.lang.String name()
          Returns the canonical name of this keypair generator.
private  void nextRandomBytes(byte[] buffer)
          Fills the designated byte array with random data.
 void setup(java.util.Map attributes)
          [Re]-initialises this instance for use with a given set of attributes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NAME

private static final java.lang.String NAME
See Also:
Constant Field Values

DEBUG

private static final boolean DEBUG
See Also:
Constant Field Values

debuglevel

private static final int debuglevel
See Also:
Constant Field Values

err

private static final java.io.PrintWriter err

SOURCE_OF_RANDOMNESS

public static final java.lang.String SOURCE_OF_RANDOMNESS
Property name of an optional java.security.SecureRandom instance to use. The default is to use a classloader singleton from gnu.java.security.util.PRNG.

See Also:
Constant Field Values

DH_PARAMETERS

public static final java.lang.String DH_PARAMETERS
Property name of an optional javax.crypto.spec.DHGenParameterSpec or javax.crypto.spec.DHParameterSpec instance to use for this generator.

See Also:
Constant Field Values

PRIME_SIZE

public static final java.lang.String PRIME_SIZE
Property name of the size in bits (Integer) of the public prime (p).

See Also:
Constant Field Values

EXPONENT_SIZE

public static final java.lang.String EXPONENT_SIZE
Property name of the size in bits (Integer) of the private exponent (x).

See Also:
Constant Field Values

PREFERRED_ENCODING_FORMAT

public static final java.lang.String PREFERRED_ENCODING_FORMAT
Property name of the preferred encoding format to use when externalizing generated instance of key-pairs from this generator. The property is taken to be an java.lang.Integer that encapsulates an encoding format identifier.

See Also:
Constant Field Values

DEFAULT_PRIME_SIZE

public static final int DEFAULT_PRIME_SIZE
Default value for the size in bits of the public prime (p).

See Also:
Constant Field Values

DEFAULT_EXPONENT_SIZE

public static final int DEFAULT_EXPONENT_SIZE
Default value for the size in bits of the private exponent (x).

See Also:
Constant Field Values

DEFAULT_ENCODING_FORMAT

private static final int DEFAULT_ENCODING_FORMAT
Default encoding format to use when none was specified.

See Also:
Constant Field Values

sha

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


rnd

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


l

private int l
The desired size in bits of the public prime (p).


m

private int m
The desired size in bits of the private exponent (x).


seed

private java.math.BigInteger seed

counter

private java.math.BigInteger counter

q

private java.math.BigInteger q

p

private java.math.BigInteger p

j

private java.math.BigInteger j

g

private java.math.BigInteger g

prng

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


preferredFormat

private int preferredFormat
Preferred encoding format of generated keys.

Constructor Detail

GnuDHKeyPairGenerator

public GnuDHKeyPairGenerator()
Method Detail

debug

private static void debug(java.lang.String s)

name

public java.lang.String name()
Description copied from interface: gnu.java.security.key.IKeyPairGenerator
Returns the canonical name of this keypair generator.

Specified by:
name in interface gnu.java.security.key.IKeyPairGenerator

setup

public void setup(java.util.Map attributes)
Description copied from interface: gnu.java.security.key.IKeyPairGenerator
[Re]-initialises this instance for use with a given set of attributes.

Specified by:
setup in interface gnu.java.security.key.IKeyPairGenerator

generate

public java.security.KeyPair generate()
Description copied from interface: gnu.java.security.key.IKeyPairGenerator
Generates a new keypair based on the attributes used to configure the instance.

Specified by:
generate in interface gnu.java.security.key.IKeyPairGenerator

nextRandomBytes

private void nextRandomBytes(byte[] buffer)

Fills the designated byte array with random data.


getDefaultPRNG

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