NativeSecp256k1

<p>This class holds native methods to handle ECDSA verification.</p>

<p>You can find an example library that can be used for this at https://github.com/bitcoin/secp256k1</p>

<p>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 </p>

Constructors

this
this(SECP256K1 flag)
Undocumented in source.

Destructor

~this
~this()

libsecp256k1 Cleanup - This destroys the secp256k1 context object This should be called at the end of the program for proper cleanup of the context.

Members

Functions

cloneContext
secp256k1_context* cloneContext()
Undocumented in source. Be warned that the author may not have intended to support it.
createECDHSecret
immutable(ubyte[]) createECDHSecret(const(ubyte[]) seckey, const(ubyte[]) pubkey)

libsecp256k1 create ECDH secret - constant time ECDH calculation

createKeyPair
void createKeyPair(const(ubyte[]) seckey, secp256k1_keypair keypair)
Undocumented in source.
createKeyPair
void createKeyPair(const(ubyte[]) seckey, ubyte[] keypair)
Undocumented in source.
getPubkey
void getPubkey(const(secp256k1_keypair) keypair, secp256k1_pubkey pubkey)
Undocumented in source. Be warned that the author may not have intended to support it.
getPubkey
immutable(ubyte[]) getPubkey(const(ubyte[]) keypair_seckey)

Takes both a seckey and keypair

getPubkey
immutable(ubyte[]) getPubkey(const(secp256k1_keypair) keypair)
Undocumented in source. Be warned that the author may not have intended to support it.
getSecretKey
void getSecretKey(const(ubyte[]) keypair, ubyte[] seckey)
Undocumented in source.
privTweak
void privTweak(const(ubyte[]) keypair, const(ubyte[]) tweak, ubyte[] tweakked_keypair)

libsecp256k1 PubKey Tweak-Mul - Tweak pubkey by multiplying to it

pubTweak
immutable(ubyte[]) pubTweak(const(ubyte[]) pubkey, const(ubyte[]) tweak)
Undocumented in source.
randomizeContext
bool randomizeContext()

libsecp256k1 randomize - updates the context randomization

sign
immutable(ubyte[]) sign(const(ubyte[]) msg, const(secp256k1_keypair) keypair, const(ubyte[]) aux_random)

libsecp256k1 Create an Schnorr signature.

sign
immutable(ubyte[]) sign(const(ubyte[]) msg, const(ubyte[]) keypair, const(ubyte[]) aux_random)
Undocumented in source.
sign
immutable(ubyte[]) sign(const(ubyte[]) msg, const(ubyte[]) keypair)
Undocumented in source. Be warned that the author may not have intended to support it.
verify
bool verify(const(ubyte[]) msg, const(ubyte[]) signature, const(ubyte[]) pubkey)

Verifies the given secp256k1 signature in native code. Calling when enabled == false is undefined (probably library not loaded)

verify
bool verify(const(ubyte[]) signature, const(ubyte[]) msg, const(secp256k1_pubkey) pubkey)
Undocumented in source.

Manifest constants

KEYPAIR_SIZE
enum KEYPAIR_SIZE;
Undocumented in source.
MESSAGE_SIZE
enum MESSAGE_SIZE;
Undocumented in source.
PUBKEY_SIZE
enum PUBKEY_SIZE;
Undocumented in source.
SECKEY_SIZE
enum SECKEY_SIZE;
Undocumented in source.
SIGNATURE_SIZE
enum SIGNATURE_SIZE;
Undocumented in source.
TWEAK_SIZE
enum TWEAK_SIZE;
Undocumented in source.
XONLY_PUBKEY_SIZE
enum XONLY_PUBKEY_SIZE;
Undocumented in source.

Static functions

check
void check(bool flag, ConsensusFailCode code, string file, size_t line)
Undocumented in source. Be warned that the author may not have intended to support it.

Variables

_ctx
secp256k1_context* _ctx;
Undocumented in source.

Meta