|
Bitcoin
|
Static Public Member Functions | |
| static boolean | verify (byte[] data, byte[] signature, byte[] pub) throws AssertFailException |
| static byte [] | sign (byte[] data, byte[] sec) throws AssertFailException |
| static boolean | secKeyVerify (byte[] seckey) |
| static byte [] | computePubkey (byte[] seckey) throws AssertFailException |
| static synchronized void | cleanup () |
| static long | cloneContext () |
| static byte [] | privKeyTweakMul (byte[] privkey, byte[] tweak) throws AssertFailException |
| static byte [] | privKeyTweakAdd (byte[] privkey, byte[] tweak) throws AssertFailException |
| static byte [] | pubKeyTweakAdd (byte[] pubkey, byte[] tweak) throws AssertFailException |
| static byte [] | pubKeyTweakMul (byte[] pubkey, byte[] tweak) throws AssertFailException |
| static byte [] | createECDHSecret (byte[] seckey, byte[] pubkey) throws AssertFailException |
| static synchronized boolean | randomize (byte[] seed) throws AssertFailException |
Static Private Member Functions | |
| static native long | secp256k1_ctx_clone (long context) |
| static native int | secp256k1_context_randomize (ByteBuffer byteBuff, long context) |
| static native byte [][] | secp256k1_privkey_tweak_add (ByteBuffer byteBuff, long context) |
| static native byte [][] | secp256k1_privkey_tweak_mul (ByteBuffer byteBuff, long context) |
| static native byte [][] | secp256k1_pubkey_tweak_add (ByteBuffer byteBuff, long context, int pubLen) |
| static native byte [][] | secp256k1_pubkey_tweak_mul (ByteBuffer byteBuff, long context, int pubLen) |
| static native void | secp256k1_destroy_context (long context) |
| static native int | secp256k1_ecdsa_verify (ByteBuffer byteBuff, long context, int sigLen, int pubLen) |
| static native byte [][] | secp256k1_ecdsa_sign (ByteBuffer byteBuff, long context) |
| static native int | secp256k1_ec_seckey_verify (ByteBuffer byteBuff, long context) |
| static native byte [][] | secp256k1_ec_pubkey_create (ByteBuffer byteBuff, long context) |
| static native byte [][] | secp256k1_ec_pubkey_parse (ByteBuffer byteBuff, long context, int inputLen) |
| static native byte [][] | secp256k1_ecdh (ByteBuffer byteBuff, long context, int inputLen) |
Static Private Attributes | |
| static final ReentrantReadWriteLock | rwl = new ReentrantReadWriteLock() |
| static final Lock | r = rwl.readLock() |
| static final Lock | w = rwl.writeLock() |
| static ThreadLocal< ByteBuffer > | nativeECDSABuffer = new ThreadLocal<ByteBuffer>() |
This class holds native methods to handle ECDSA verification.
You can find an example library that can be used for this at https://github.com/bitcoin/secp256k1
To build secp256k1 for use with bitcoinj, run ./configure --enable-jni --enable-experimental --enable-module-ecdh and make then copy .libs/libsecp256k1.so to your system library path or point the JVM to the folder containing it with -Djava.library.path
|
inlinestatic |
libsecp256k1 Cleanup - This destroys the secp256k1 context object This should be called at the end of the program for proper cleanup of the context.
|
inlinestatic |
|
inlinestatic |
libsecp256k1 Compute Pubkey - computes public key from secret key
| seckey | ECDSA Secret key, 32 bytes |
Return values
| pubkey | ECDSA Public key, 33 or 65 bytes |
|
inlinestatic |
libsecp256k1 create ECDH secret - constant time ECDH calculation
| seckey | byte array of secret key used in exponentiaion |
| pubkey | byte array of public key used in exponentiaion |
|
inlinestatic |
libsecp256k1 PrivKey Tweak-Add - Tweak privkey by adding to it
| tweak | some bytes to tweak with |
| seckey | 32-byte seckey |
|
inlinestatic |
libsecp256k1 PrivKey Tweak-Mul - Tweak privkey by multiplying to it
| tweak | some bytes to tweak with |
| seckey | 32-byte seckey |
|
inlinestatic |
libsecp256k1 PubKey Tweak-Add - Tweak pubkey by adding to it
| tweak | some bytes to tweak with |
| pubkey | 32-byte seckey |
|
inlinestatic |
libsecp256k1 PubKey Tweak-Mul - Tweak pubkey by multiplying to it
| tweak | some bytes to tweak with |
| pubkey | 32-byte seckey |
|
inlinestatic |
libsecp256k1 randomize - updates the context randomization
| seed | 32-byte random seed |
|
inlinestatic |
libsecp256k1 Seckey Verify - returns 1 if valid, 0 if invalid
| seckey | ECDSA Secret key, 32 bytes |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
inlinestatic |
libsecp256k1 Create an ECDSA signature.
| data | Message hash, 32 bytes |
| key | Secret key, 32 bytes |
Return values
| sig | byte array of signature |
|
inlinestatic |
Verifies the given secp256k1 signature in native code. Calling when enabled == false is undefined (probably library not loaded)
| data | The data which was signed, must be exactly 32 bytes |
| signature | The signature |
| pub | The public key which did the signing |
|
staticprivate |
|
staticprivate |
|
staticprivate |
|
staticprivate |
1.8.15