oracle.security.crypto.core
Class DiffieHellman

Implementation of the Diffie-Hellman public key agreement algorithm, as defined in PKCS#3.

Once a DiffieHellman object has been instantiated, use the myValue() method to obtain the value to send to the peer (g^x). The method getKey(java.math.BigInteger) is used to compute the shared Diffie-Hellman key value.

DiffieHellman(java.math.BigInteger p, java.math.BigInteger g, RandomBitsSource rbs)
Constructs a DiffieHellman object with the specified values for the prime (p) and generator (g), and creates a random value for x.

DiffieHellman(RandomBitsSource rbs, int len)
Constructs a DiffieHellman object, creating a random prime (p) of the given bit length, and a random value x; the generator (g) is set to 4.