|
Oracle Security Developer Tools Crypto Java API Reference 10g (10.1.4.0.1) B28171-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object
oracle.security.crypto.core.DiffieHellman
This class encapsulates the Diffie-Hellman public key agreement algorithm.
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.
Field Summary | |
protected java.math.BigInteger |
g The generator. |
protected java.math.BigInteger |
gx The generated value g^x. |
protected java.math.BigInteger |
p The prime. |
protected java.math.BigInteger |
x The large random integer. |
Constructor Summary | |
DiffieHellman() Creates a new, uninitialized DiffieHellman instance. |
|
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. |
Method Summary | |
protected void |
generatePandG(RandomBitsSource rbs, int len) Generates a random prime (p) of the given bit length for this DiffieHellman and sets the generator (g) to 4. |
protected void |
generateValues(RandomBitsSource rbs) Generates a large random integer (x) for this DiffieHellman , and uses its prime (p) and generator (g) to compute the value g^x. |
java.math.BigInteger |
getGen() Returns the generator (g). |
static DiffieHellman |
getInstance() |
static DiffieHellman |
getInstance(java.math.BigInteger p, java.math.BigInteger g, RandomBitsSource rbs) |
static DiffieHellman |
getInstance(RandomBitsSource rbs, int len) |
java.math.BigInteger |
getKey(java.math.BigInteger gy) Computes the shared DH key value g^(xy). |
java.math.BigInteger |
getPrime() Returns the prime (p). |
void |
initialize(java.math.BigInteger p, java.math.BigInteger g, RandomBitsSource rbs) Sets the prime (p) and generator (g) for this DiffieHellman , and invokes generateValues(oracle.security.crypto.core.RandomBitsSource) . |
void |
initialize(RandomBitsSource rbs, int len) Generates the prime (p), generator (g) and values (x and g^x) by invoking generatePandG(oracle.security.crypto.core.RandomBitsSource, int) and generateValues(oracle.security.crypto.core.RandomBitsSource) . |
java.math.BigInteger |
myValue() Returns the generated value g^x. |
java.lang.String |
toString() Returns a string representation of this object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected java.math.BigInteger p
protected java.math.BigInteger g
protected java.math.BigInteger x
protected java.math.BigInteger gx
Constructor Detail |
public DiffieHellman()
DiffieHellman
instance.public DiffieHellman(RandomBitsSource rbs, int len) throws java.lang.IllegalArgumentException
DiffieHellman
object, creating a random prime (p) of the given bit length, and a random value x; the generator (g) is set to 4.public DiffieHellman(java.math.BigInteger p, java.math.BigInteger g, RandomBitsSource rbs)
DiffieHellman
object with the specified values for the prime (p) and generator (g), and creates a random value for x.Method Detail |
public static DiffieHellman getInstance() throws AlgorithmIdentifierException
AlgorithmIdentifierException
public static DiffieHellman getInstance(RandomBitsSource rbs, int len) throws java.lang.IllegalArgumentException, AlgorithmIdentifierException
java.lang.IllegalArgumentException
AlgorithmIdentifierException
public static DiffieHellman getInstance(java.math.BigInteger p, java.math.BigInteger g, RandomBitsSource rbs) throws AlgorithmIdentifierException
AlgorithmIdentifierException
public void initialize(RandomBitsSource rbs, int len)
generatePandG(oracle.security.crypto.core.RandomBitsSource, int)
and generateValues(oracle.security.crypto.core.RandomBitsSource)
.public void initialize(java.math.BigInteger p, java.math.BigInteger g, RandomBitsSource rbs)
DiffieHellman
, and invokes generateValues(oracle.security.crypto.core.RandomBitsSource)
.protected void generatePandG(RandomBitsSource rbs, int len)
DiffieHellman
and sets the generator (g) to 4.protected void generateValues(RandomBitsSource rbs)
DiffieHellman
, and uses its prime (p) and generator (g) to compute the value g^x.public java.math.BigInteger getPrime()
public java.math.BigInteger getGen()
public java.math.BigInteger myValue()
public java.math.BigInteger getKey(java.math.BigInteger gy)
gy
- The generated value received from the peer.public java.lang.String toString()
|
Oracle Security Developer Tools Crypto Java API Reference 10g (10.1.4.0.1) B28171-01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |