diff options
-rw-r--r-- | build.gradle | 16 | ||||
-rw-r--r-- | java/src/main/java/org/whispersystems/libaxolotl/ecc/Curve.java | 30 | ||||
-rw-r--r-- | libs/gradle-witness.jar | bin | 20436 -> 0 bytes |
3 files changed, 13 insertions, 33 deletions
diff --git a/build.gradle b/build.gradle index 9ba1f225..db998e8e 100644 --- a/build.gradle +++ b/build.gradle @@ -1,21 +1,7 @@ -buildscript { - dependencies { - classpath files('libs/gradle-witness.jar') - } -} - subprojects { - apply plugin: 'witness' - ext.version_number = "1.0.1" ext.group_info = "org.whispersystems" - ext.curve25519_version = "0.1.3" - - dependencyVerification { - verify = [ - 'com.google.protobuf:protobuf-java:e0c1c64575c005601725e7c6a02cebf9e1285e888f756b2a1d73ffa8d725cc74', - ] - } + ext.curve25519_version = "0.2.1" if (JavaVersion.current().isJava8Compatible()) { allprojects { diff --git a/java/src/main/java/org/whispersystems/libaxolotl/ecc/Curve.java b/java/src/main/java/org/whispersystems/libaxolotl/ecc/Curve.java index 5d47e3aa..9f2c202a 100644 --- a/java/src/main/java/org/whispersystems/libaxolotl/ecc/Curve.java +++ b/java/src/main/java/org/whispersystems/libaxolotl/ecc/Curve.java @@ -16,24 +16,23 @@ */ package org.whispersystems.libaxolotl.ecc; +import org.whispersystems.curve25519.Curve25519; import org.whispersystems.curve25519.Curve25519KeyPair; +import org.whispersystems.curve25519.NoSuchProviderException; import org.whispersystems.libaxolotl.InvalidKeyException; -import org.whispersystems.curve25519.Curve25519; -import java.security.NoSuchAlgorithmException; -import java.security.SecureRandom; +import static org.whispersystems.curve25519.Curve25519.BEST; public class Curve { public static final int DJB_TYPE = 0x05; public static boolean isNative() { - return Curve25519.isNative(); + return Curve25519.getInstance(BEST).isNative(); } public static ECKeyPair generateKeyPair() { - SecureRandom secureRandom = getSecureRandom(); - Curve25519KeyPair keyPair = Curve25519.generateKeyPair(secureRandom); + Curve25519KeyPair keyPair = Curve25519.getInstance(BEST).generateKeyPair(); return new ECKeyPair(new DjbECPublicKey(keyPair.getPublicKey()), new DjbECPrivateKey(keyPair.getPrivateKey())); @@ -66,8 +65,9 @@ public class Curve { } if (publicKey.getType() == DJB_TYPE) { - return Curve25519.calculateAgreement(((DjbECPublicKey)publicKey).getPublicKey(), - ((DjbECPrivateKey)privateKey).getPrivateKey()); + return Curve25519.getInstance(BEST) + .calculateAgreement(((DjbECPublicKey) publicKey).getPublicKey(), + ((DjbECPrivateKey) privateKey).getPrivateKey()); } else { throw new InvalidKeyException("Unknown type: " + publicKey.getType()); } @@ -77,7 +77,8 @@ public class Curve { throws InvalidKeyException { if (signingKey.getType() == DJB_TYPE) { - return Curve25519.verifySignature(((DjbECPublicKey)signingKey).getPublicKey(), message, signature); + return Curve25519.getInstance(BEST) + .verifySignature(((DjbECPublicKey) signingKey).getPublicKey(), message, signature); } else { throw new InvalidKeyException("Unknown type: " + signingKey.getType()); } @@ -87,17 +88,10 @@ public class Curve { throws InvalidKeyException { if (signingKey.getType() == DJB_TYPE) { - return Curve25519.calculateSignature(getSecureRandom(), ((DjbECPrivateKey)signingKey).getPrivateKey(), message); + return Curve25519.getInstance(BEST) + .calculateSignature(((DjbECPrivateKey) signingKey).getPrivateKey(), message); } else { throw new InvalidKeyException("Unknown type: " + signingKey.getType()); } } - - private static SecureRandom getSecureRandom() { - try { - return SecureRandom.getInstance("SHA1PRNG"); - } catch (NoSuchAlgorithmException e) { - throw new AssertionError(e); - } - } } diff --git a/libs/gradle-witness.jar b/libs/gradle-witness.jar Binary files differdeleted file mode 100644 index 561041d3..00000000 --- a/libs/gradle-witness.jar +++ /dev/null |