Destroyable, DHStateclass Curve25519DHState extends Object implements DHState
| Constructor | Description |
|---|---|
Curve25519DHState(X25519KeyFactory xdh) |
Constructs a new Diffie-Hellman object for Curve25519.
|
| Modifier and Type | Method | Description |
|---|---|---|
void |
calculate(byte[] sharedKey,
int offset,
DHState publicDH) |
Performs a Diffie-Hellman calculation with this object as the private key.
|
void |
clearKey() |
Clears the key pair.
|
void |
copyFrom(DHState other) |
Copies the key values from another DH object of the same type.
|
void |
destroy() |
Destroys all sensitive state in the current object.
|
void |
generateKeyPair() |
Generates a new random keypair.
|
String |
getDHName() |
Gets the Noise protocol name for this Diffie-Hellman algorithm.
|
void |
getPrivateKey(byte[] key,
int offset) |
Gets the private key associated with this object.
|
int |
getPrivateKeyLength() |
Gets the length of private keys for this algorithm.
|
void |
getPublicKey(byte[] key,
int offset) |
Gets the public key associated with this object.
|
int |
getPublicKeyLength() |
Gets the length of public keys for this algorithm.
|
int |
getSharedKeyLength() |
Gets the length of shared keys for this algorithm.
|
boolean |
hasPrivateKey() |
Determine if this object contains a private key.
|
boolean |
hasPublicKey() |
Determine if this object contains a public key.
|
boolean |
isNullPublicKey() |
Determine if the public key in this object is the special null value.
|
void |
setPrivateKey(byte[] key,
int offset) |
Sets the private key for this object.
|
void |
setPublicKey(byte[] key,
int offset) |
Sets the public key for this object.
|
void |
setToNullPublicKey() |
Sets this object to the null public key and clears the private key.
|
public Curve25519DHState(X25519KeyFactory xdh)
public void destroy()
Destroyabledestroy in interface Destroyablepublic String getDHName()
DHStatepublic int getPublicKeyLength()
DHStategetPublicKeyLength in interface DHStatepublic int getPrivateKeyLength()
DHStategetPrivateKeyLength in interface DHStatepublic int getSharedKeyLength()
DHStategetSharedKeyLength in interface DHStatepublic void generateKeyPair()
DHStategenerateKeyPair in interface DHStatepublic void getPublicKey(byte[] key,
int offset)
DHStategetPublicKey in interface DHStatekey - The buffer to copy the public key to.offset - The first offset in the key buffer to copy to.public void setPublicKey(byte[] key,
int offset)
DHStatesetPublicKey in interface DHStatekey - The buffer containing the public key.offset - The first offset in the buffer that contains the key.
If this object previously held a key pair, then this function
will change it into a public key only object.public void getPrivateKey(byte[] key,
int offset)
DHStategetPrivateKey in interface DHStatekey - The buffer to copy the private key to.offset - The first offset in the key buffer to copy to.public void setPrivateKey(byte[] key,
int offset)
DHStatesetPrivateKey in interface DHStatekey - The buffer containing the [rivate key.offset - The first offset in the buffer that contains the key.
If this object previously held only a public key, then
this function will change it into a key pair.public void setToNullPublicKey()
DHStatesetToNullPublicKey in interface DHStatepublic void clearKey()
DHStatepublic boolean hasPublicKey()
DHStatehasPublicKey in interface DHStatepublic boolean hasPrivateKey()
DHStatehasPrivateKey in interface DHStatepublic boolean isNullPublicKey()
DHStateisNullPublicKey in interface DHStatepublic void calculate(byte[] sharedKey,
int offset,
DHState publicDH)
DHState