From a7b04fce1942060d833b769f13ac21ae2a590393 Mon Sep 17 00:00:00 2001 From: Moxie Marlinspike Date: Fri, 1 May 2015 10:29:13 -0700 Subject: Upgrade to Curve25519 0.2.4 --- .../org/whispersystems/libaxolotl/CurveTest.java | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) (limited to 'android/src/androidTest') diff --git a/android/src/androidTest/java/org/whispersystems/libaxolotl/CurveTest.java b/android/src/androidTest/java/org/whispersystems/libaxolotl/CurveTest.java index bb539d49..baaea356 100644 --- a/android/src/androidTest/java/org/whispersystems/libaxolotl/CurveTest.java +++ b/android/src/androidTest/java/org/whispersystems/libaxolotl/CurveTest.java @@ -11,16 +11,16 @@ public class CurveTest extends TestCase { assertTrue(Curve.isNative()); } - public void testSignatureOverflow() throws InvalidKeyException { - ECKeyPair keys = Curve.generateKeyPair(); - byte[] message = new byte[4096]; - - try { - byte[] signature = Curve.calculateSignature(keys.getPrivateKey(), message); - throw new InvalidKeyException("Should have asserted!"); - } catch (AssertionError e) { - // Success! - } + public void testLargeSignatures() throws InvalidKeyException { + ECKeyPair keys = Curve.generateKeyPair(); + byte[] message = new byte[1024 * 1024]; + byte[] signature = Curve.calculateSignature(keys.getPrivateKey(), message); + + assertTrue(Curve.verifySignature(keys.getPublicKey(), message, signature)); + + message[0] ^= 0x01; + + assertFalse(Curve.verifySignature(keys.getPublicKey(), message, signature)); } } -- cgit v1.2.3