[][src]Struct k256::ecdsa::recoverable::Signature

pub struct Signature { /* fields omitted */ }
This is supported on crate feature ecdsa-core only.

Ethereum-style "recoverable signatures" which allow for the recovery of the signer's VerifyKey from the signature itself.

This format consists of Signature followed by a 1-byte recovery Id (65-bytes total):

  • r: 32-byte integer, big endian
  • s: 32-byte integer, big endian
  • v: 1-byte recovery Id

Implementations

impl Signature[src]

pub fn new(signature: &Signature, recovery_id: Id) -> Result<Self, Error>[src]

Create a new recoverable ECDSA/secp256k1 signature from a regular fixed-size signature and an associated recovery Id.

This is an "unchecked" conversion and assumes the provided Id is valid for this signature.

pub fn recovery_id(self) -> Id[src]

Get the recovery Id for this signature

pub fn from_trial_recovery(
    public_key: &VerifyKey,
    msg: &[u8],
    signature: &Signature
) -> Result<Self, Error>
[src]

This is supported on crate features ecdsa and keccak256 only.

Given a public key, message, and signature, use trial recovery to determine if a suitable recovery ID exists, or return an error otherwise.

Assumes Keccak256 as the message digest function. Use Signature::from_digest_trial_recovery to support other digest functions.

pub fn from_digest_trial_recovery<D>(
    public_key: &VerifyKey,
    digest: D,
    signature: &Signature
) -> Result<Self, Error> where
    D: Clone + Digest<OutputSize = U32>, 
[src]

This is supported on crate feature ecdsa only.

Given a public key, message digest, and signature, use trial recovery to determine if a suitable recovery ID exists, or return an error otherwise.

pub fn recover_verify_key(&self, msg: &[u8]) -> Result<VerifyKey, Error>[src]

This is supported on crate features ecdsa and keccak256 only.

Recover the public key used to create the given signature as a VerifyKey.

pub fn recover_verify_key_from_digest<D>(
    &self,
    msg_digest: D
) -> Result<VerifyKey, Error> where
    D: Digest<OutputSize = U32>, 
[src]

This is supported on crate feature ecdsa only.

Recover the public key used to create the given signature as a VerifyKey from the provided precomputed [Digest].

pub fn recover_verify_key_from_digest_bytes(
    &self,
    digest_bytes: &FieldBytes
) -> Result<VerifyKey, Error>
[src]

This is supported on crate feature ecdsa only.

Recover the public key used to create the given signature as a VerifyKey from the raw bytes of a message digest.

pub fn r(&self) -> NonZeroScalar[src]

This is supported on crate feature ecdsa only.

Parse the r component of this signature to a NonZeroScalar

pub fn s(&self) -> NonZeroScalar[src]

This is supported on crate feature ecdsa only.

Parse the s component of this signature to a NonZeroScalar

Trait Implementations

impl AsRef<[u8]> for Signature[src]

impl Clone for Signature[src]

impl Copy for Signature[src]

impl Debug for Signature[src]

impl<D> DigestSigner<D, Signature> for SigningKey where
    D: BlockInput + FixedOutput<OutputSize = U32> + Clone + Default + Reset + Update, 
[src]

impl<D> DigestVerifier<D, Signature> for VerifyKey where
    D: Digest<OutputSize = U32>, 
[src]

impl Eq for Signature[src]

impl From<Signature> for Signature[src]

impl PartialEq<Signature> for Signature[src]

impl PrehashSignature for Signature[src]

type Digest = Keccak256

Preferred Digest algorithm to use when computing this signature type.

impl<D> RandomizedDigestSigner<D, Signature> for SigningKey where
    D: BlockInput + FixedOutput<OutputSize = U32> + Clone + Default + Reset + Update, 
[src]

impl Signature for Signature[src]

impl<'_> TryFrom<&'_ [u8]> for Signature[src]

type Error = Error

The type returned in the event of a conversion error.

Auto Trait Implementations

Blanket Implementations

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

impl<A, T> AsBits<T> for A where
    A: AsRef<[T]>,
    T: BitStore + BitMemory, 

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

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

impl<T> Conv for T

impl<T> FmtForward for T

impl<T> From<T> for T[src]

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

impl<T> Pipe for T

impl<T> PipeAsRef for T

impl<T> PipeBorrow for T

impl<T> PipeDeref for T

impl<T> PipeRef for T

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Tap for T

impl<T, U> TapAsRef<U> for T where
    U: ?Sized

impl<T, U> TapBorrow<U> for T where
    U: ?Sized

impl<T> TapDeref for T

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

type Owned = T

The resulting type after obtaining ownership.

impl<T> TryConv for T

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.