pub struct SECP256K1 { /* private fields */ }

Methods from Deref<Target = Secp256k1<All>>

👎 Deprecated since 0.21.0:

Use sign_ecdsa_recoverable instead.

Constructs a signature for msg using the secret key sk and RFC6979 nonce. Requires a signing-capable context.

Constructs a signature for msg using the secret key sk and RFC6979 nonce Requires a signing-capable context.

Constructs a signature for msg using the secret key sk and RFC6979 nonce and includes 32 bytes of noncedata in the nonce generation via inclusion in one of the hash operations during nonce generation. This is useful when multiple signatures are needed for the same Message and SecretKey while still using RFC6979. Requires a signing-capable context.

👎 Deprecated since 0.21.0:

Use recover_ecdsa instead.

Determines the public key for which sig is a valid signature for msg. Requires a verify-capable context.

Determines the public key for which sig is a valid signature for msg. Requires a verify-capable context.

👎 Deprecated since 0.21.0:

Use sign_ecdsa instead.

Constructs a signature for msg using the secret key sk and RFC6979 nonce Requires a signing-capable context.

Constructs a signature for msg using the secret key sk and RFC6979 nonce Requires a signing-capable context.

Constructs a signature for msg using the secret key sk and RFC6979 nonce and includes 32 bytes of noncedata in the nonce generation via inclusion in one of the hash operations during nonce generation. This is useful when multiple signatures are needed for the same Message and SecretKey while still using RFC6979. Requires a signing-capable context.

👎 Deprecated since 0.21.0:

Use sign_ecdsa_grind_r instead.

Constructs a signature for msg using the secret key sk, RFC6979 nonce and “grinds” the nonce by passing extra entropy if necessary to produce a signature that is less than 71 - bytes_to_grind bytes. The number of signing operation performed by this function is exponential in the number of bytes grinded. Requires a signing capable context.

Constructs a signature for msg using the secret key sk, RFC6979 nonce and “grinds” the nonce by passing extra entropy if necessary to produce a signature that is less than 71 - bytes_to_grind bytes. The number of signing operation performed by this function is exponential in the number of bytes grinded. Requires a signing capable context.

👎 Deprecated since 0.21.0:

Use sign_ecdsa_low_r instead.

Constructs a signature for msg using the secret key sk, RFC6979 nonce and “grinds” the nonce by passing extra entropy if necessary to produce a signature that is less than 71 bytes and compatible with the low r signature implementation of bitcoin core. In average, this function will perform two signing operations. Requires a signing capable context.

Constructs a signature for msg using the secret key sk, RFC6979 nonce and “grinds” the nonce by passing extra entropy if necessary to produce a signature that is less than 71 bytes and compatible with the low r signature implementation of bitcoin core. In average, this function will perform two signing operations. Requires a signing capable context.

👎 Deprecated since 0.21.0:

Use verify_ecdsa instead

Checks that sig is a valid ECDSA signature for msg using the public key pubkey. Returns Ok(()) on success. Note that this function cannot be used for Bitcoin consensus checking since there may exist signatures which OpenSSL would verify but not libsecp256k1, or vice-versa. Requires a verify-capable context.

let message = Message::from_slice(&[0xab; 32]).expect("32 bytes");
let sig = secp.sign(&message, &secret_key);
assert_eq!(secp.verify(&message, &sig, &public_key), Ok(()));

let message = Message::from_slice(&[0xcd; 32]).expect("32 bytes");
assert_eq!(secp.verify(&message, &sig, &public_key), Err(Error::IncorrectSignature));

Checks that sig is a valid ECDSA signature for msg using the public key pubkey. Returns Ok(()) on success. Note that this function cannot be used for Bitcoin consensus checking since there may exist signatures which OpenSSL would verify but not libsecp256k1, or vice-versa. Requires a verify-capable context.

let message = Message::from_slice(&[0xab; 32]).expect("32 bytes");
let sig = secp.sign_ecdsa(&message, &secret_key);
assert_eq!(secp.verify_ecdsa(&message, &sig, &public_key), Ok(()));

let message = Message::from_slice(&[0xcd; 32]).expect("32 bytes");
assert_eq!(secp.verify_ecdsa(&message, &sig, &public_key), Err(Error::IncorrectSignature));
👎 Deprecated since 0.21.0:

Use sign_schnorr instead.

Create a schnorr signature internally using the ThreadRng random number generator to generate the auxiliary random data.

Create a schnorr signature internally using the ThreadRng random number generator to generate the auxiliary random data.

👎 Deprecated since 0.21.0:

Use sign_schnorr_no_aux_rand instead.

Create a schnorr signature without using any auxiliary random data.

Create a schnorr signature without using any auxiliary random data.

👎 Deprecated since 0.21.0:

Use sign_schnorr_with_aux_rand instead.

Create a Schnorr signature using the given auxiliary random data.

Create a Schnorr signature using the given auxiliary random data.

👎 Deprecated since 0.21.0:

Use sign_schnorr_with_rng instead.

Create a schnorr signature using the given random number generator to generate the auxiliary random data.

Create a schnorr signature using the given random number generator to generate the auxiliary random data.

👎 Deprecated since 0.21.0:

Use verify_schnorr instead.

Verify a Schnorr signature.

Verify a Schnorr signature.

👎 Deprecated since 0.21.0:

Use kp = KeyPair::new() and kp.x_only_public_key().0

Generates a random Schnorr KeyPair and its associated Schnorr XOnlyPublicKey.

Convenience function for KeyPair::new and KeyPair::public_key. Requires a signing-capable context.

Getter for the raw pointer to the underlying secp256k1 context. This shouldn’t be needed with normal usage of the library. It enables extending the Secp256k1 with more cryptographic algorithms outside of this crate.

Generates a random keypair. Convenience function for SecretKey::new and PublicKey::from_secret_key.

Trait Implementations

The resulting type after dereferencing.

Dereferences the value.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.