4 * This class holds the context reference used in native methods
5 to handle ECDSA operations.
7 public class Secp256k1Context {
8 private static final boolean enabled; //true if the library is loaded
9 private static final long context; //ref to pointer to context obj
11 static { //static initializer
12 boolean isEnabled = true;
15 System.loadLibrary("secp256k1");
16 contextRef = secp256k1_init_context();
17 } catch (UnsatisfiedLinkError e) {
18 System.out.println("UnsatisfiedLinkError: " + e.toString());
25 public static boolean isEnabled() {
29 public static long getContext() {
30 if(!enabled) return -1; //sanity check
34 private static native long secp256k1_init_context();