mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-05-02 06:33:38 +01:00
Add ed25519
This commit is contained in:
@@ -39,6 +39,9 @@ public class Curve25519 {
|
||||
private static native byte[] generatePublicKey(byte[] privateKey);
|
||||
private static native byte[] generatePrivateKey(byte[] random, boolean ephemeral);
|
||||
|
||||
private static native byte[] calculateSignature(byte[] privateKey, byte[] message);
|
||||
private static native boolean verifySignature(byte[] publicKey, byte[] message, byte[] signature);
|
||||
|
||||
public static ECKeyPair generateKeyPair(boolean ephemeral) {
|
||||
byte[] privateKey = generatePrivateKey(ephemeral);
|
||||
byte[] publicKey = generatePublicKey(privateKey);
|
||||
@@ -51,6 +54,14 @@ public class Curve25519 {
|
||||
((DjbECPublicKey)publicKey).getPublicKey());
|
||||
}
|
||||
|
||||
static byte[] calculateSignature(ECPrivateKey privateKey, byte[] message) {
|
||||
return calculateSignature(((DjbECPrivateKey)privateKey).getPrivateKey(), message);
|
||||
}
|
||||
|
||||
static boolean verifySignature(ECPublicKey publicKey, byte[] message, byte[] signature) {
|
||||
return verifySignature(((DjbECPublicKey)publicKey).getPublicKey(), message, signature);
|
||||
}
|
||||
|
||||
static ECPublicKey decodePoint(byte[] encoded, int offset)
|
||||
throws InvalidKeyException
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user