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

Commit

Permalink
Add license information.
Browse files Browse the repository at this point in the history
  • Loading branch information
moxie0 committed Jan 8, 2015
1 parent c8d383b commit 834de83
Show file tree
Hide file tree
Showing 10 changed files with 161 additions and 9 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ obj/
build/
.gradle/
local.properties
gradle.properties
47 changes: 40 additions & 7 deletions README.md
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
9 changes: 9 additions & 0 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -92,3 +100,4 @@ task installArchives(type: Upload) {
}
}
}

6 changes: 4 additions & 2 deletions build.gradle
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"
}
27 changes: 27 additions & 0 deletions java/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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
}
16 changes: 16 additions & 0 deletions java/src/main/java/org/whispersystems/curve25519/Curve25519.java
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down

0 comments on commit 834de83

Please sign in to comment.