aboutsummaryrefslogtreecommitdiffstats
path: root/java/src/test/java/org/whispersystems/libaxolotl/CurveTest.java
blob: 734f6c86095cf194747c11c65383e7169249bd9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
package org.whispersystems.libaxolotl;

import junit.framework.TestCase;

import org.whispersystems.libaxolotl.ecc.Curve;
import org.whispersystems.libaxolotl.ecc.ECKeyPair;

public class CurveTest extends TestCase {

  public void testPureJava() {
    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!
    }
  }

}