Add license information.

This commit is contained in:
Moxie Marlinspike 2015-01-08 15:19:11 -08:00
parent c8d383bbb0
commit 834de837c9
10 changed files with 161 additions and 9 deletions

1
.gitignore vendored
View File

@ -5,3 +5,4 @@ obj/
build/
.gradle/
local.properties
gradle.properties

View File

@ -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

View File

@ -73,6 +73,14 @@ uploadArchives {
developerConnection 'scm:git@github.com:WhisperSystems/curve25519-java.git'
}
licenses {
license {
name 'GPLv3'
url 'https://www.gnu.org/licenses/gpl-3.0.txt'
distribution 'repo'
}
}
developers {
developer {
name 'Trevor Perrin'
@ -92,3 +100,4 @@ task installArchives(type: Upload) {
}
}
}

View File

@ -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"
}

View File

@ -42,6 +42,14 @@ uploadArchives {
developerConnection 'scm:git@github.com:WhisperSystems/curve25519-java.git'
}
licenses {
license {
name 'GPLv3'
url 'https://www.gnu.org/licenses/gpl-3.0.txt'
distribution 'repo'
}
}
developers {
developer {
name 'Trevor Perrin'
@ -61,3 +69,22 @@ task installArchives(type: Upload) {
}
}
}
task packageJavadoc(type: Jar, dependsOn: 'javadoc') {
from javadoc.destinationDir
classifier = 'javadoc'
}
task packageSources(type: Jar) {
from sourceSets.main.allSource
classifier = 'sources'
}
artifacts {
archives(packageJavadoc) {
type = 'javadoc'
}
archives packageSources
}

View File

@ -1,3 +1,19 @@
/**
* Copyright (C) 2015 Open Whisper Systems
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.whispersystems.curve25519;
import java.security.SecureRandom;

View File

@ -1,3 +1,19 @@
/**
* Copyright (C) 2015 Open Whisper Systems
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.whispersystems.curve25519;
/**

View File

@ -1,3 +1,19 @@
/**
* Copyright (C) 2015 Open Whisper Systems
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.whispersystems.curve25519;
interface Curve25519Provider {

View File

@ -1,3 +1,19 @@
/**
* Copyright (C) 2015 Open Whisper Systems
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.whispersystems.curve25519;
import org.whispersystems.curve25519.java.curve_sigs;

View File

@ -1,3 +1,19 @@
/**
* Copyright (C) 2015 Open Whisper Systems
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.whispersystems.curve25519;
class NativeCurve25519Provider implements Curve25519Provider {