Class Bouncy256k1
java.lang.Object
org.bitcoinj.secp.bouncy.Bouncy256k1
- All Implemented Interfaces:
Closeable, AutoCloseable, Secp256k1
-
Nested Class Summary
Nested classes/interfaces inherited from interface Secp256k1
Secp256k1.Provider, Secp256k1.ProviderId -
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Override close and declare that no checked exceptions are thrownecdh(SecpPubKey pubKey, SecpPrivKey secKey) ECDH key agreementecdsaSign(byte[] msg_hash_data, SecpPrivKey seckey) Sign a message hash using the ECDSA algorithmecdsaSignatureParseCompact(byte[] serialized_signature) Parse a Bitcoin compact signature.byte[]Serialize aEcdsaSignatureas a Bitcoin compact signature.ecdsaVerify(EcdsaSignature signature, byte[] msg_hash_data, SecpPubKey pubKey) Verify an ECDSA signature.Create a new, randomly-generated private key and return it with its matching public keyecKeyPairCreate(SecpPrivKey privKey) Create a key pair structure from a known private keyCreate a new, randomly-generated private key.ecPubKeyCombine(SecpPubKey key1, SecpPubKey key2) Combine two public keys by adding them.ecPubKeyCreate(SecpPrivKey seckey) Create a public key from the given private key.ecPubKeyParse(byte[] inputData) Parse a byte array as a public keybyte[]ecPubKeySerialize(SecpPubKey pubKey, int flags) Serialize a public keyecPubKeyTweakMul(SecpPubKey pubKey, BigInteger scalarMultiplier) Multiply a public key by a scalar, this is known as key "tweaking"schnorrSigSign32(byte[] msg_hash, SecpKeyPair keyPair) Create a Schnorr signature for a message.schnorrSigVerify(SchnorrSignature signature, byte[] msg_hash, SecpXOnlyPubKey pubKey) Verify a Schnorr signature.byte[]taggedSha256(byte[] tag, byte[] message) Generate a tagged SHA-256 hash.Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface Secp256k1
ecPointUncompress, schnorrSigVerify, taggedSha256
-
Constructor Details
-
Bouncy256k1
public Bouncy256k1()Default constructor.
-
-
Method Details
-
ecPrivKeyCreate
Description copied from interface:Secp256k1Create a new, randomly-generated private key.- Specified by:
ecPrivKeyCreatein interfaceSecp256k1- Returns:
- the private key
-
ecPubKeyCreate
Description copied from interface:Secp256k1Create a public key from the given private key.- Specified by:
ecPubKeyCreatein interfaceSecp256k1- Parameters:
seckey- the private key- Returns:
- derived public key
-
ecKeyPairCreate
Description copied from interface:Secp256k1Create a new, randomly-generated private key and return it with its matching public key- Specified by:
ecKeyPairCreatein interfaceSecp256k1- Returns:
- newly generated key pair
-
ecKeyPairCreate
Description copied from interface:Secp256k1Create a key pair structure from a known private key- Specified by:
ecKeyPairCreatein interfaceSecp256k1- Parameters:
privKey- the private key- Returns:
- object containing both public and private key
-
ecPubKeyTweakMul
Description copied from interface:Secp256k1Multiply a public key by a scalar, this is known as key "tweaking"- Specified by:
ecPubKeyTweakMulin interfaceSecp256k1- Parameters:
pubKey- public key representing a point on the curvescalarMultiplier- scalar multiplier- Returns:
- the product
-
ecPubKeyCombine
Description copied from interface:Secp256k1Combine two public keys by adding them.- Specified by:
ecPubKeyCombinein interfaceSecp256k1- Parameters:
key1- first keykey2- second key- Returns:
- the sum
-
ecPubKeySerialize
Description copied from interface:Secp256k1Serialize a public key- Specified by:
ecPubKeySerializein interfaceSecp256k1- Parameters:
pubKey- public key to serializeflags- serialization flags- Returns:
- pubKey serialized as a byte array
-
ecPubKeyParse
Description copied from interface:Secp256k1Parse a byte array as a public key- Specified by:
ecPubKeyParsein interfaceSecp256k1- Parameters:
inputData- raw data to parse as public key- Returns:
- public key result or error
-
ecdsaSign
Description copied from interface:Secp256k1Sign a message hash using the ECDSA algorithm -
ecdsaSignatureSerializeCompact
Description copied from interface:Secp256k1Serialize aEcdsaSignatureas a Bitcoin compact signature. A compact signature is the two signature component field integers (known asrands) serialized in-order as binary data in big-endian format.- Specified by:
ecdsaSignatureSerializeCompactin interfaceSecp256k1- Parameters:
sig- signature object- Returns:
- compact signature bytes
-
ecdsaSignatureParseCompact
Description copied from interface:Secp256k1Parse a Bitcoin compact signature. A compact signature is the two signature component field integers (known asrands) serialized in-order as binary data in big-endian format.- Specified by:
ecdsaSignatureParseCompactin interfaceSecp256k1- Parameters:
serialized_signature- compact signature bytes- Returns:
- signature object
-
ecdsaVerify
public SecpResult<Boolean> ecdsaVerify(EcdsaSignature signature, byte[] msg_hash_data, SecpPubKey pubKey) Description copied from interface:Secp256k1Verify an ECDSA signature.- Specified by:
ecdsaVerifyin interfaceSecp256k1- Parameters:
signature- The signature to verify.msg_hash_data- A hash of the message to verify.pubKey- The pubkey that must have signed the message- Returns:
- true, false, or error
-
taggedSha256
public byte[] taggedSha256(byte[] tag, byte[] message) Description copied from interface:Secp256k1Generate a tagged SHA-256 hash.- Specified by:
taggedSha256in interfaceSecp256k1- Parameters:
tag- a tag specifying the context of usagemessage- the message itself- Returns:
- the SHA-256 HASH
-
schnorrSigSign32
Description copied from interface:Secp256k1Create a Schnorr signature for a message.- Specified by:
schnorrSigSign32in interfaceSecp256k1- Parameters:
msg_hash- a hash of a message to signkeyPair- the keypair for signing- Returns:
- the signature
-
schnorrSigVerify
public SecpResult<Boolean> schnorrSigVerify(SchnorrSignature signature, byte[] msg_hash, SecpXOnlyPubKey pubKey) Description copied from interface:Secp256k1Verify a Schnorr signature.- Specified by:
schnorrSigVerifyin interfaceSecp256k1- Parameters:
signature- the signature to verifymsg_hash- hash of the messagepubKey- x-only pubkey that must have signed the message- Returns:
- true, false, or error
-
ecdh
Description copied from interface:Secp256k1ECDH key agreement -
close
-