public class Curve25519
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static java.lang.String |
BEST |
static java.lang.String |
J2ME |
static java.lang.String |
JAVA |
static java.lang.String |
NATIVE |
| Modifier and Type | Method and Description |
|---|---|
byte[] |
calculateAgreement(byte[] publicKey,
byte[] privateKey)
Calculates an ECDH agreement.
|
byte[] |
calculateSignature(byte[] privateKey,
byte[] message)
Calculates a Curve25519 signature.
|
Curve25519KeyPair |
generateKeyPair()
Generates a Curve25519 keypair.
|
static Curve25519 |
getInstance(java.lang.String type) |
static Curve25519 |
getInstance(java.lang.String type,
SecureRandomProvider random) |
boolean |
isNative()
Curve25519 is backed by either a native (via JNI)
or pure-Java provider. |
boolean |
verifySignature(byte[] publicKey,
byte[] message,
byte[] signature)
Verify a Curve25519 signature.
|
public static final java.lang.String NATIVE
public static final java.lang.String JAVA
public static final java.lang.String J2ME
public static final java.lang.String BEST
public static Curve25519 getInstance(java.lang.String type) throws NoSuchProviderException
NoSuchProviderExceptionpublic static Curve25519 getInstance(java.lang.String type, SecureRandomProvider random) throws NoSuchProviderException
NoSuchProviderExceptionpublic boolean isNative()
Curve25519 is backed by either a native (via JNI)
or pure-Java provider. By default it prefers the native provider, and falls back to the
pure-Java provider if the native library fails to load.public Curve25519KeyPair generateKeyPair()
public byte[] calculateAgreement(byte[] publicKey,
byte[] privateKey)
publicKey - The Curve25519 (typically remote party's) public key.privateKey - The Curve25519 (typically yours) private key.public byte[] calculateSignature(byte[] privateKey,
byte[] message)
privateKey - The private Curve25519 key to create the signature with.message - The message to sign.public boolean verifySignature(byte[] publicKey,
byte[] message,
byte[] signature)
publicKey - The Curve25519 public key the signature belongs to.message - The message that was signed.signature - The signature to verify.