Dash Core Source Documentation (0.16.0.1)
Find detailed information regarding the Dash Core source code.
Static Public Member Functions | |
static boolean | verify (byte[] data, byte[] signature, byte[] pub) throws AssertFailException |
Verifies the given secp256k1 signature in native code. More... | |
static byte [] | sign (byte[] data, byte[] sec) throws AssertFailException |
libsecp256k1 Create an ECDSA signature. More... | |
static boolean | secKeyVerify (byte[] seckey) |
libsecp256k1 Seckey Verify - returns 1 if valid, 0 if invalid More... | |
static byte [] | computePubkey (byte[] seckey) throws AssertFailException |
libsecp256k1 Compute Pubkey - computes public key from secret key More... | |
static synchronized void | cleanup () |
libsecp256k1 Cleanup - This destroys the secp256k1 context object This should be called at the end of the program for proper cleanup of the context. More... | |
static long | cloneContext () |
static byte [] | privKeyTweakMul (byte[] privkey, byte[] tweak) throws AssertFailException |
libsecp256k1 PrivKey Tweak-Mul - Tweak privkey by multiplying to it More... | |
static byte [] | privKeyTweakAdd (byte[] privkey, byte[] tweak) throws AssertFailException |
libsecp256k1 PrivKey Tweak-Add - Tweak privkey by adding to it More... | |
static byte [] | pubKeyTweakAdd (byte[] pubkey, byte[] tweak) throws AssertFailException |
libsecp256k1 PubKey Tweak-Add - Tweak pubkey by adding to it More... | |
static byte [] | pubKeyTweakMul (byte[] pubkey, byte[] tweak) throws AssertFailException |
libsecp256k1 PubKey Tweak-Mul - Tweak pubkey by multiplying to it More... | |
static byte [] | createECDHSecret (byte[] seckey, byte[] pubkey) throws AssertFailException |
libsecp256k1 create ECDH secret - constant time ECDH calculation More... | |
static synchronized boolean | randomize (byte[] seed) throws AssertFailException |
libsecp256k1 randomize - updates the context randomization More... | |
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>() |
Detailed Description
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
Definition at line 40 of file NativeSecp256k1.java.
Member Function Documentation
◆ cleanup()
|
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.
Definition at line 187 of file NativeSecp256k1.java.
References org.bitcoin.Secp256k1Context.getContext(), org.bitcoin.NativeSecp256k1.secp256k1_destroy_context(), and org.bitcoin.NativeSecp256k1.w.
Referenced by org.bitcoin.NativeSecp256k1Test.main().
◆ cloneContext()
|
inlinestatic |
Definition at line 196 of file NativeSecp256k1.java.
References org.bitcoin.Secp256k1Context.getContext(), org.bitcoin.NativeSecp256k1.r, and org.bitcoin.NativeSecp256k1.secp256k1_ctx_clone().
◆ computePubkey()
|
inlinestatic |
libsecp256k1 Compute Pubkey - computes public key from secret key
- Parameters
-
seckey ECDSA Secret key, 32 bytes
Return values
- Parameters
-
pubkey ECDSA Public key, 33 or 65 bytes
Definition at line 153 of file NativeSecp256k1.java.
References org.bitcoin.Secp256k1Context.getContext(), org.bitcoin.NativeSecp256k1.nativeECDSABuffer, org.bitcoin.NativeSecp256k1.r, and org.bitcoin.NativeSecp256k1.secp256k1_ec_pubkey_create().
Referenced by org.bitcoin.NativeSecp256k1Test.testPubKeyCreateNeg(), and org.bitcoin.NativeSecp256k1Test.testPubKeyCreatePos().
◆ createECDHSecret()
|
inlinestatic |
libsecp256k1 create ECDH secret - constant time ECDH calculation
- Parameters
-
seckey byte array of secret key used in exponentiaion pubkey byte array of public key used in exponentiaion
Definition at line 365 of file NativeSecp256k1.java.
References org.bitcoin.Secp256k1Context.getContext(), org.bitcoin.NativeSecp256k1.nativeECDSABuffer, org.bitcoin.NativeSecp256k1.r, and org.bitcoin.NativeSecp256k1.secp256k1_ecdh().
Referenced by org.bitcoin.NativeSecp256k1Test.testCreateECDHSecret().
◆ privKeyTweakAdd()
|
inlinestatic |
libsecp256k1 PrivKey Tweak-Add - Tweak privkey by adding to it
- Parameters
-
tweak some bytes to tweak with seckey 32-byte seckey
Definition at line 248 of file NativeSecp256k1.java.
References org.bitcoin.Secp256k1Context.getContext(), org.bitcoin.NativeSecp256k1.nativeECDSABuffer, org.bitcoin.NativeSecp256k1.r, and org.bitcoin.NativeSecp256k1.secp256k1_privkey_tweak_add().
Referenced by org.bitcoin.NativeSecp256k1Test.testPrivKeyTweakAdd_1().
◆ privKeyTweakMul()
|
inlinestatic |
libsecp256k1 PrivKey Tweak-Mul - Tweak privkey by multiplying to it
- Parameters
-
tweak some bytes to tweak with seckey 32-byte seckey
Definition at line 209 of file NativeSecp256k1.java.
References org.bitcoin.Secp256k1Context.getContext(), org.bitcoin.NativeSecp256k1.nativeECDSABuffer, org.bitcoin.NativeSecp256k1.r, and org.bitcoin.NativeSecp256k1.secp256k1_privkey_tweak_mul().
Referenced by org.bitcoin.NativeSecp256k1Test.testPrivKeyTweakMul_1().
◆ pubKeyTweakAdd()
|
inlinestatic |
libsecp256k1 PubKey Tweak-Add - Tweak pubkey by adding to it
- Parameters
-
tweak some bytes to tweak with pubkey 32-byte seckey
Definition at line 287 of file NativeSecp256k1.java.
References org.bitcoin.Secp256k1Context.getContext(), org.bitcoin.NativeSecp256k1.nativeECDSABuffer, org.bitcoin.NativeSecp256k1.r, and org.bitcoin.NativeSecp256k1.secp256k1_pubkey_tweak_add().
Referenced by org.bitcoin.NativeSecp256k1Test.testPrivKeyTweakAdd_2().
◆ pubKeyTweakMul()
|
inlinestatic |
libsecp256k1 PubKey Tweak-Mul - Tweak pubkey by multiplying to it
- Parameters
-
tweak some bytes to tweak with pubkey 32-byte seckey
Definition at line 326 of file NativeSecp256k1.java.
References org.bitcoin.Secp256k1Context.getContext(), org.bitcoin.NativeSecp256k1.nativeECDSABuffer, org.bitcoin.NativeSecp256k1.r, and org.bitcoin.NativeSecp256k1.secp256k1_pubkey_tweak_mul().
Referenced by org.bitcoin.NativeSecp256k1Test.testPrivKeyTweakMul_2().
◆ randomize()
|
inlinestatic |
libsecp256k1 randomize - updates the context randomization
- Parameters
-
seed 32-byte random seed
Definition at line 400 of file NativeSecp256k1.java.
References org.bitcoin.Secp256k1Context.getContext(), org.bitcoin.NativeSecp256k1.nativeECDSABuffer, org.bitcoin.NativeSecp256k1.secp256k1_context_randomize(), and org.bitcoin.NativeSecp256k1.w.
Referenced by org.bitcoin.NativeSecp256k1Test.testRandomize().
◆ secKeyVerify()
|
inlinestatic |
libsecp256k1 Seckey Verify - returns 1 if valid, 0 if invalid
- Parameters
-
seckey ECDSA Secret key, 32 bytes
Definition at line 123 of file NativeSecp256k1.java.
References org.bitcoin.Secp256k1Context.getContext(), org.bitcoin.NativeSecp256k1.nativeECDSABuffer, org.bitcoin.NativeSecp256k1.r, and org.bitcoin.NativeSecp256k1.secp256k1_ec_seckey_verify().
Referenced by org.bitcoin.NativeSecp256k1Test.testSecKeyVerifyNeg(), and org.bitcoin.NativeSecp256k1Test.testSecKeyVerifyPos().
◆ secp256k1_context_randomize()
|
staticprivate |
Referenced by org.bitcoin.NativeSecp256k1.randomize().
◆ secp256k1_ctx_clone()
|
staticprivate |
Referenced by org.bitcoin.NativeSecp256k1.cloneContext().
◆ secp256k1_destroy_context()
|
staticprivate |
Referenced by org.bitcoin.NativeSecp256k1.cleanup().
◆ secp256k1_ec_pubkey_create()
|
staticprivate |
Referenced by org.bitcoin.NativeSecp256k1.computePubkey().
◆ secp256k1_ec_pubkey_parse()
|
staticprivate |
◆ secp256k1_ec_seckey_verify()
|
staticprivate |
Referenced by org.bitcoin.NativeSecp256k1.secKeyVerify().
◆ secp256k1_ecdh()
|
staticprivate |
Referenced by org.bitcoin.NativeSecp256k1.createECDHSecret().
◆ secp256k1_ecdsa_sign()
|
staticprivate |
Referenced by org.bitcoin.NativeSecp256k1.sign().
◆ secp256k1_ecdsa_verify()
|
staticprivate |
Referenced by org.bitcoin.NativeSecp256k1.verify().
◆ secp256k1_privkey_tweak_add()
|
staticprivate |
Referenced by org.bitcoin.NativeSecp256k1.privKeyTweakAdd().
◆ secp256k1_privkey_tweak_mul()
|
staticprivate |
Referenced by org.bitcoin.NativeSecp256k1.privKeyTweakMul().
◆ secp256k1_pubkey_tweak_add()
|
staticprivate |
Referenced by org.bitcoin.NativeSecp256k1.pubKeyTweakAdd().
◆ secp256k1_pubkey_tweak_mul()
|
staticprivate |
Referenced by org.bitcoin.NativeSecp256k1.pubKeyTweakMul().
◆ sign()
|
inlinestatic |
libsecp256k1 Create an ECDSA signature.
- Parameters
-
data Message hash, 32 bytes key Secret key, 32 bytes
Return values
- Parameters
-
sig byte array of signature
Definition at line 87 of file NativeSecp256k1.java.
References org.bitcoin.Secp256k1Context.getContext(), org.bitcoin.NativeSecp256k1.nativeECDSABuffer, org.bitcoin.NativeSecp256k1.r, and org.bitcoin.NativeSecp256k1.secp256k1_ecdsa_sign().
Referenced by org.bitcoin.NativeSecp256k1Test.testSignNeg(), and org.bitcoin.NativeSecp256k1Test.testSignPos().
◆ verify()
|
inlinestatic |
Verifies the given secp256k1 signature in native code.
Calling when enabled == false is undefined (probably library not loaded)
- Parameters
-
data The data which was signed, must be exactly 32 bytes signature The signature pub The public key which did the signing
Definition at line 54 of file NativeSecp256k1.java.
References org.bitcoin.Secp256k1Context.getContext(), org.bitcoin.NativeSecp256k1.nativeECDSABuffer, org.bitcoin.NativeSecp256k1.r, and org.bitcoin.NativeSecp256k1.secp256k1_ecdsa_verify().
Referenced by org.bitcoin.NativeSecp256k1Test.testVerifyNeg(), and org.bitcoin.NativeSecp256k1Test.testVerifyPos().
Member Data Documentation
◆ nativeECDSABuffer
|
staticprivate |
Definition at line 45 of file NativeSecp256k1.java.
Referenced by org.bitcoin.NativeSecp256k1.computePubkey(), org.bitcoin.NativeSecp256k1.createECDHSecret(), org.bitcoin.NativeSecp256k1.privKeyTweakAdd(), org.bitcoin.NativeSecp256k1.privKeyTweakMul(), org.bitcoin.NativeSecp256k1.pubKeyTweakAdd(), org.bitcoin.NativeSecp256k1.pubKeyTweakMul(), org.bitcoin.NativeSecp256k1.randomize(), org.bitcoin.NativeSecp256k1.secKeyVerify(), org.bitcoin.NativeSecp256k1.sign(), and org.bitcoin.NativeSecp256k1.verify().
◆ r
|
staticprivate |
Definition at line 43 of file NativeSecp256k1.java.
Referenced by org.bitcoin.NativeSecp256k1.cloneContext(), org.bitcoin.NativeSecp256k1.computePubkey(), org.bitcoin.NativeSecp256k1.createECDHSecret(), org.bitcoin.NativeSecp256k1.privKeyTweakAdd(), org.bitcoin.NativeSecp256k1.privKeyTweakMul(), org.bitcoin.NativeSecp256k1.pubKeyTweakAdd(), org.bitcoin.NativeSecp256k1.pubKeyTweakMul(), org.bitcoin.NativeSecp256k1.secKeyVerify(), org.bitcoin.NativeSecp256k1.sign(), and org.bitcoin.NativeSecp256k1.verify().
◆ rwl
|
staticprivate |
Definition at line 42 of file NativeSecp256k1.java.
◆ w
|
staticprivate |
Definition at line 44 of file NativeSecp256k1.java.
Referenced by org.bitcoin.NativeSecp256k1.cleanup(), and org.bitcoin.NativeSecp256k1.randomize().
The documentation for this class was generated from the following file:
- src/secp256k1/src/java/org/bitcoin/NativeSecp256k1.java