diff options
Diffstat (limited to 'java')
-rw-r--r-- | java/src/test/java/org/whispersystems/libaxolotl/CurveTest.java | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/java/src/test/java/org/whispersystems/libaxolotl/CurveTest.java b/java/src/test/java/org/whispersystems/libaxolotl/CurveTest.java index 734f6c86..24c62132 100644 --- a/java/src/test/java/org/whispersystems/libaxolotl/CurveTest.java +++ b/java/src/test/java/org/whispersystems/libaxolotl/CurveTest.java @@ -11,16 +11,16 @@ public class CurveTest extends TestCase { assertFalse(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 (IllegalArgumentException 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)); } } |