Struct ckb_crypto::secp::SECP256K1 [−][src]
pub struct SECP256K1 { /* fields omitted */ }
Expand description
The reference to lazily-initialized static secp256k1 engine, used to execute all signature operations
Methods from Deref<Target = Secp256k1<All>>
pub fn sign_recoverable(
&self,
msg: &Message,
sk: &SecretKey
) -> RecoverableSignature
[src]
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 verify(
&self,
msg: &Message,
sig: &Signature,
pk: &PublicKey
) -> Result<(), Error>
[src]
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(())
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));
Trait Implementations
impl LazyStatic for SECP256K1
[src]
impl LazyStatic for SECP256K1
[src]fn initialize(lazy: &Self)
[src]
Auto Trait Implementations
impl RefUnwindSafe for SECP256K1
impl Send for SECP256K1
impl Sync for SECP256K1
impl Unpin for SECP256K1
impl UnwindSafe for SECP256K1
Blanket Implementations
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]pub fn borrow_mut(&mut self) -> &mut T
[src]
pub fn borrow_mut(&mut self) -> &mut T
[src]Mutably borrows from an owned value. Read more
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,