[][src]Struct secp256k1::Secp256k1

pub struct Secp256k1<C> { /* fields omitted */ }

The secp256k1 engine, used to execute all signature operations

Methods

impl Secp256k1<All>
[src]

pub fn new() -> Secp256k1<All>
[src]

Creates a new Secp256k1 context with all capabilities

impl Secp256k1<SignOnly>
[src]

pub fn signing_only() -> Secp256k1<SignOnly>
[src]

Creates a new Secp256k1 context that can only be used for signing

impl Secp256k1<VerifyOnly>
[src]

pub fn verification_only() -> Secp256k1<VerifyOnly>
[src]

Creates a new Secp256k1 context that can only be used for verification

impl<C> Secp256k1<C>
[src]

pub fn randomize<R: Rng>(&mut self, rng: &mut R)
[src]

(Re)randomizes the Secp256k1 context for cheap sidechannel resistance; see comment in libsecp256k1 commit d2275795f by Gregory Maxwell. Requires compilation with "rand" feature.

impl<C: Signing> Secp256k1<C>
[src]

pub fn sign(&self, msg: &Message, sk: &SecretKey) -> Signature
[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
) -> RecoverableSignature
[src]

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

pub fn generate_keypair<R: Rng>(&self, rng: &mut R) -> (SecretKey, PublicKey)
[src]

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. Requires compilation with the "rand" feature.

impl<C: Verification> Secp256k1<C>
[src]

pub fn recover(
    &self,
    msg: &Message,
    sig: &RecoverableSignature
) -> Result<PublicKey, Error>
[src]

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]

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<C> Eq for Secp256k1<C>
[src]

impl<C> Drop for Secp256k1<C>
[src]

impl<C> Send for Secp256k1<C>
[src]

impl<C> Sync for Secp256k1<C>
[src]

impl<C> PartialEq<Secp256k1<C>> for Secp256k1<C>
[src]

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0
[src]

This method tests for !=.

impl<C> Clone for Secp256k1<C>
[src]

fn clone_from(&mut self, source: &Self)
1.0.0
[src]

Performs copy-assignment from source. Read more

impl Debug for Secp256k1<SignOnly>
[src]

impl Debug for Secp256k1<VerifyOnly>
[src]

impl Debug for Secp256k1<All>
[src]

Blanket Implementations

impl<T> From for T
[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

impl<T, U> TryFrom for T where
    T: From<U>, 
[src]

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

impl<T> Any for T where
    T: 'static + ?Sized
[src]