aboutsummaryrefslogtreecommitdiffstats
path: root/android/src/androidTest/java/org/whispersystems/libaxolotl/CurveTest.java
blob: bb539d49009db34258266ffa3f8f0c9bb71138a3 (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() {
    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!
    }
  }

}