| Constructor and Description |
|---|
Curve25519DHState(net.i2p.crypto.KeyFactory xdh)
Constructs a new Diffie-Hellman object for Curve25519.
|
| Modifier and Type | Method and 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.
|
Curve25519DHState |
clone()
I2P
|
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 |
getEncodedPublicKey(byte[] key,
int offset)
I2P
|
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 |
hasEncodedPublicKey()
I2P
|
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 |
setKeys(byte[] privkey,
int privoffset,
byte[] pubkey,
int puboffset)
Sets the private and public keys for this object.
|
void |
setPrivateKey(byte[] key,
int offset)
Deprecated.
use setKeys()
|
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(net.i2p.crypto.KeyFactory 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.@Deprecated 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 setKeys(byte[] privkey,
int privoffset,
byte[] pubkey,
int puboffset)
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 boolean hasEncodedPublicKey()
hasEncodedPublicKey in interface DHStatepublic void getEncodedPublicKey(byte[] key,
int offset)
getEncodedPublicKey in interface DHStatekey - The buffer to copy the public key to.offset - The first offset in the key buffer to copy to.public void calculate(byte[] sharedKey,
int offset,
DHState publicDH)
DHStatepublic void copyFrom(DHState other)
DHStatepublic Curve25519DHState clone() throws CloneNotSupportedException
clone in interface DHStateclone in class ObjectCloneNotSupportedException