This repository has been archived by the owner on Apr 18, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 98
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
161 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,4 @@ obj/ | |
build/ | ||
.gradle/ | ||
local.properties | ||
gradle.properties |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,28 +1,61 @@ | ||
# curve25519-java | ||
|
||
# DO NOT USE THIS YET | ||
A Java Curve25519 implementation that is backed by native code when available, and | ||
pure Java when a native library is not available. | ||
|
||
## Generating a Curve25519 keypair: | ||
## 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(); | ||
Curve25519KeyPair keyPair = Curve25519.generateKeyPair(secureRandom); | ||
``` | ||
|
||
## Calculating a shared secret: | ||
### Calculating a shared secret: | ||
|
||
``` | ||
byte[] sharedSecret = Curve25519.calculateAgreement(publicKey, privateKey); | ||
``` | ||
|
||
## Calculating a signature: | ||
### Calculating a signature: | ||
|
||
``` | ||
SecureRandom secureRandom = SecureRandom.getInstance("SHA1PRNG"); | ||
byte[] signature = Curve25519.calculateSignature(secureRandom, privateKey, message); | ||
``` | ||
|
||
## Verifying a signature: | ||
### 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
ext.version_number = "0.1.3" | ||
ext.group_info = "org.whispersystems" | ||
subprojects { | ||
ext.version_number = "0.1.3" | ||
ext.group_info = "org.whispersystems" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
java/src/main/java/org/whispersystems/curve25519/Curve25519.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
java/src/main/java/org/whispersystems/curve25519/Curve25519KeyPair.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
java/src/main/java/org/whispersystems/curve25519/Curve25519Provider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
java/src/main/java/org/whispersystems/curve25519/JavaCurve25519Provider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
16 changes: 16 additions & 0 deletions
16
java/src/main/java/org/whispersystems/curve25519/NativeCurve25519Provider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters