# [−] Struct keys::SECP256K1

    pub struct SECP256K1 { /* fields omitted */ }

## Methods from __Deref<Target = Secp256k1>

####

`pub fn sign_schnorr( &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>` |

Verify a Schnorr signature

####

`pub fn recover_schnorr( &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.

####

`pub fn generate_keypair<R>( &self, rng: &mut R ) -> Result<(SecretKey, PublicKey), Error> where R: Rng,` |

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>` |

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>` |

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>` |

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>` |

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 __Deref for SECP256K1`

#### `type Target = Secp256k1`

The resulting type after dereferencing.

####

`fn deref(&self) -> &Secp256k1` |

Dereferences the value.

###

`impl LazyStatic for SECP256K1`

####

`fn initialize(lazy: &Self)` |

## Auto Trait Implementations

###

`impl Send for SECP256K1`

###

`impl Sync for SECP256K1`

## Blanket Implementations

###

`impl<T> From for T`

[src]

####

`fn from(t: T) -> T`

[src]

Performs the conversion.

###

`impl<T, U> Into for T where U: From<T>,`

[src]

####

`fn into(self) -> U`

[src]

Performs the conversion.

###

`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.

####

`fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>`

[src]

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

Performs the conversion.

###

`impl<T> Borrow for T where T: ?Sized,`

[src]

####
ⓘImportant traits for &'a mut R

### Important traits for &'a mut R

`impl<'a, R> Read for &'a mut R where
R: Read + ?Sized, impl<'a, W> Write for &'a mut W where
W: Write + ?Sized, impl<'a, I> Iterator for &'a mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;`

`fn borrow(&self) -> &T`

[src]

Immutably borrows from an owned value. Read more

###

`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.

####

`fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>`

[src]

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

Performs the conversion.

###

`impl<T> BorrowMut for T where T: ?Sized,`

[src]

####
ⓘImportant traits for &'a mut R

### Important traits for &'a mut R

`impl<'a, R> Read for &'a mut R where
R: Read + ?Sized, impl<'a, W> Write for &'a mut W where
W: Write + ?Sized, impl<'a, I> Iterator for &'a mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;`

`fn borrow_mut(&mut self) -> &mut T`

[src]

Mutably borrows from an owned value. Read more

###

`impl<T> Any for T where T: 'static + ?Sized,`

[src]

####

`fn get_type_id(&self) -> TypeId`

[src]

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

this method will likely be replaced by an associated static

Gets the `TypeId` of `self`. Read more

# Help

## Keyboard Shortcuts

`?`
  Show this help dialog
`S`
  Focus the search field
`↑`
  Move up in search results
`↓`
  Move down in search results
`↹`
  Switch tab
`⏎`
  Go to active search result
`+`
  Expand all sections
`-`
  Collapse all sections

## Search Tricks

Prefix searches with a type followed by a colon (e.g. `fn:`) to restrict the search to a given type.

Accepted types are: `fn`, `mod`, `struct`, `enum`, `trait`, `type`, `macro`, and `const`.

Search functions by type signature (e.g. `vec -> usize` or `* -> vec`)

Search multiple things at once by splitting your query with comma (e.g. `str,u8` or `String,struct:Vec,test`)