public class CkiDiffieHellman
extends oracle.security.crypto.core.DiffieHellman
Once a DiffieHellman
object has been instantiated, use the DiffieHellman.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.
Constructor and Description |
---|
CkiDiffieHellman()
Creates a new, uninitialized
CkiDiffieHellman object. |
Modifier and Type | Method and Description |
---|---|
protected void |
generateValues(oracle.security.crypto.core.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. |
CkiSymmetricKey |
getCkiKey()
Returns the
CkiSymmetricKey representing the Diffie Hellman key, or throw an Exception if the key has not been computed on the token before (by calling getKey |
CkiSymmetricKey |
getCkiKey(java.math.BigInteger gy)
Returns the
CkiSymmetricKey representing the Diffie Hellman key, or throw an Exception if the key could not be computed on the token. |
java.math.BigInteger |
getKey(java.math.BigInteger gy)
Computes the shared DH key value g^(xy).
|
void |
initialize(java.math.BigInteger p, java.math.BigInteger g, oracle.security.crypto.core.RandomBitsSource rbs, boolean sensitive)
Sets the prime (p) and generator (g) for this
DiffieHellman , invokes generateValues(oracle.security.crypto.core.RandomBitsSource) , and sets whether the generated key materials are sensitive on the Cryptoki token (default true ). |
void |
initialize(oracle.security.crypto.core.RandomBitsSource rbs, int len, boolean sensitive)
Generates the prime (p), generator (g) and values (x and g^x) by invoking
#generatePandG and generateValues(oracle.security.crypto.core.RandomBitsSource) , and sets whether the generated key materials are sensitive on the Cryptoki token (default true ). |
void |
setSession(CkiMgtSession session)
Sets the session to use for this CkiDiffieHellman object: this session will be used if there is a need to import/generate the keys on the token.
|
public CkiDiffieHellman()
CkiDiffieHellman
object.public void setSession(CkiMgtSession session)
session
- The CkiMgtSession
to use for import/generation operation.public void initialize(oracle.security.crypto.core.RandomBitsSource rbs, int len, boolean sensitive)
#generatePandG
and generateValues(oracle.security.crypto.core.RandomBitsSource)
, and sets whether the generated key materials are sensitive on the Cryptoki token (default true
).public void initialize(java.math.BigInteger p, java.math.BigInteger g, oracle.security.crypto.core.RandomBitsSource rbs, boolean sensitive)
DiffieHellman
, invokes generateValues(oracle.security.crypto.core.RandomBitsSource)
, and sets whether the generated key materials are sensitive on the Cryptoki token (default true
).protected void generateValues(oracle.security.crypto.core.RandomBitsSource rbs)
DiffieHellman
, and uses its prime (p) and generator (g) to compute the value g^x.public java.math.BigInteger getKey(java.math.BigInteger gy)
getKey
in class oracle.security.crypto.core.DiffieHellman
gy
- The generated value received from the peer.public CkiSymmetricKey getCkiKey(java.math.BigInteger gy) throws CryptokiException
CkiSymmetricKey
representing the Diffie Hellman key, or throw an Exception if the key could not be computed on the token. In that last case, use getKey()
.CryptokiException
public CkiSymmetricKey getCkiKey() throws CryptokiException
CkiSymmetricKey
representing the Diffie Hellman key, or throw an Exception if the key has not been computed on the token before (by calling getKey
CryptokiException