[−][src]Struct secp256k1::Secp256k1
The secp256k1 engine, used to execute all signature operations
Methods
impl Secp256k1
[src]
pub fn sign_schnorr(
&self,
msg: &Message,
sk: &SecretKey
) -> Result<Signature, Error>
[src]
&self,
msg: &Message,
sk: &SecretKey
) -> Result<Signature, Error>
Create a Schnorr signature
pub fn verify_schnorr(
&self,
msg: &Message,
sig: &Signature,
pk: &PublicKey
) -> Result<(), Error>
[src]
&self,
msg: &Message,
sig: &Signature,
pk: &PublicKey
) -> Result<(), Error>
Verify a Schnorr signature
pub fn recover_schnorr(
&self,
msg: &Message,
sig: &Signature
) -> Result<PublicKey, Error>
[src]
&self,
msg: &Message,
sig: &Signature
) -> Result<PublicKey, Error>
Retrieves the public key for which sig
is a valid signature for msg
.
Requires a verify-capable context.
impl Secp256k1
[src]
pub fn new() -> Secp256k1
[src]
Creates a new Secp256k1 context
pub fn with_caps(caps: ContextFlag) -> Secp256k1
[src]
Creates a new Secp256k1 context with the specified capabilities
pub fn without_caps() -> Secp256k1
[src]
Creates a new Secp256k1 context with no capabilities (just de/serialization)
pub fn randomize<R: Rng>(&mut self, rng: &mut R)
[src]
(Re)randomizes the Secp256k1 context for cheap sidechannel resistence; see comment in libsecp256k1 commit d2275795f by Gregory Maxwell
pub fn generate_keypair<R: Rng>(
&self,
rng: &mut R
) -> Result<(SecretKey, PublicKey), Error>
[src]
&self,
rng: &mut R
) -> Result<(SecretKey, PublicKey), Error>
Generates a random keypair. Convenience function for key::SecretKey::new
and key::PublicKey::from_secret_key
; call those functions directly for
batch key generation. Requires a signing-capable context.
pub fn sign(&self, msg: &Message, sk: &SecretKey) -> Result<Signature, Error>
[src]
Constructs a signature for msg
using the secret key sk
and RFC6979 nonce
Requires a signing-capable context.
pub fn sign_recoverable(
&self,
msg: &Message,
sk: &SecretKey
) -> Result<RecoverableSignature, Error>
[src]
&self,
msg: &Message,
sk: &SecretKey
) -> Result<RecoverableSignature, Error>
Constructs a signature for msg
using the secret key sk
and RFC6979 nonce
Requires a signing-capable context.
pub fn recover(
&self,
msg: &Message,
sig: &RecoverableSignature
) -> Result<PublicKey, Error>
[src]
&self,
msg: &Message,
sig: &RecoverableSignature
) -> Result<PublicKey, Error>
Determines the public key for which sig
is a valid signature for
msg
. Requires a verify-capable context.
pub fn verify(
&self,
msg: &Message,
sig: &Signature,
pk: &PublicKey
) -> Result<(), Error>
[src]
&self,
msg: &Message,
sig: &Signature,
pk: &PublicKey
) -> Result<(), Error>
Checks that sig
is a valid ECDSA signature for msg
using the public
key pubkey
. Returns Ok(true)
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.
Trait Implementations
impl Sync for Secp256k1
[src]
impl Clone for Secp256k1
[src]
fn clone(&self) -> Secp256k1
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl Drop for Secp256k1
[src]
impl Send for Secp256k1
[src]
impl Eq for Secp256k1
[src]
impl PartialEq<Secp256k1> for Secp256k1
[src]
fn eq(&self, other: &Secp256k1) -> bool
[src]
#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]
This method tests for !=
.
impl Debug for Secp256k1
[src]
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,