Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.
/ curve25519-java Public archive

Pure Java and JNI backed Curve25519 implementation.

License

Notifications You must be signed in to change notification settings

signalapp/curve25519-java

 
 

Repository files navigation

curve25519-java

A Java Curve25519 implementation that is backed by native code when available, and pure Java when a native library is not available.

Installing

To use on Android:

dependencies {
  compile 'org.whispersystems:curve25519-android:(latest version number here)'
}

To use from pure Java:

<dependency>
  <groupId>org.whispersystems</groupId>
  <artifactId>curve25519-java</artifactId>
  <version>(latest version number here)</version>
</dependency>

The Android artifact is an AAR that contains an NDK-backed native implementation, while the Java artifact is a JAR that only contains the pure-Java Curve25519 provider.

Using

Generating a Curve25519 keypair:

SecureRandom      secureRandom = SecureRandom.getInstance("SHA1PRNG");
Curve25519KeyPair keyPair      = Curve25519.generateKeyPair(secureRandom);

Calculating a shared secret:

byte[] sharedSecret = Curve25519.calculateAgreement(publicKey, privateKey);

Calculating a signature:

SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG");
byte[]       signature    = Curve25519.calculateSignature(secureRandom, privateKey, message);

Verifying a signature:

boolean validSignature = Curve25519.verifySignature(publicKey, message, signature);

License

Copyright 2015 Open Whisper Systems

Licensed under the GPLv3: http://www.gnu.org/licenses/gpl-3.0.html

About

Pure Java and JNI backed Curve25519 implementation.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages