diff options
Diffstat (limited to 'android')
-rw-r--r-- | android/src/androidTest/java/org/whispersystems/libaxolotl/CurveTest.java | 20 |
1 files changed, 10 insertions, 10 deletions
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)); } } |