Struct coins_bip32::ecdsa::recoverable::Signature
source · [−]pub struct Signature { /* private fields */ }
Expand description
Ethereum-style “recoverable signatures” which allow for the recovery of
the signer’s VerifyingKey
from the signature itself.
This format consists of Signature
followed by a 1-byte recovery Id
(65-bytes total):
r
: 32-byte integer, big endians
: 32-byte integer, big endianv
: 1-byte recoveryId
Implementations
sourceimpl Signature
impl Signature
Re-exported signer traits
sourcepub fn recovery_id(self) -> Id
pub fn recovery_id(self) -> Id
Get the recovery Id
for this signature
sourcepub fn from_digest_trial_recovery<D>(
public_key: &VerifyingKey,
digest: D,
signature: &Signature<Secp256k1>
) -> Result<Signature, Error> where
D: Clone + Digest<OutputSize = UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>> + FixedOutput,
pub fn from_digest_trial_recovery<D>(
public_key: &VerifyingKey,
digest: D,
signature: &Signature<Secp256k1>
) -> Result<Signature, Error> where
D: Clone + Digest<OutputSize = UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>> + FixedOutput,
Given a public key, message digest, and signature, use trial recovery to determine if a suitable recovery ID exists, or return an error otherwise.
sourcepub fn recover_verifying_key_from_digest<D>(
&self,
msg_digest: D
) -> Result<VerifyingKey, Error> where
D: Digest<OutputSize = UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>>,
pub fn recover_verifying_key_from_digest<D>(
&self,
msg_digest: D
) -> Result<VerifyingKey, Error> where
D: Digest<OutputSize = UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>>,
Recover the public key used to create the given signature as a
VerifyingKey
from the provided precomputed Digest
.
sourcepub fn recover_verifying_key_from_digest_bytes(
&self,
digest_bytes: &GenericArray<u8, <<Secp256k1 as Curve>::UInt as ArrayEncoding>::ByteSize>
) -> Result<VerifyingKey, Error>
pub fn recover_verifying_key_from_digest_bytes(
&self,
digest_bytes: &GenericArray<u8, <<Secp256k1 as Curve>::UInt as ArrayEncoding>::ByteSize>
) -> Result<VerifyingKey, Error>
Recover the public key used to create the given signature as a
VerifyingKey
from the raw bytes of a message digest.
sourcepub fn r(&self) -> NonZeroScalar<Secp256k1>
pub fn r(&self) -> NonZeroScalar<Secp256k1>
Parse the r
component of this signature to a NonZeroScalar
sourcepub fn s(&self) -> NonZeroScalar<Secp256k1>
pub fn s(&self) -> NonZeroScalar<Secp256k1>
Parse the s
component of this signature to a NonZeroScalar
Trait Implementations
sourceimpl<D> DigestSigner<D, Signature> for DerivedXPriv where
D: FixedOutput<OutputSize = U32> + Clone + Default + Reset + Update + HashMarker,
impl<D> DigestSigner<D, Signature> for DerivedXPriv where
D: FixedOutput<OutputSize = U32> + Clone + Default + Reset + Update + HashMarker,
sourcefn try_sign_digest(&self, digest: D) -> Result<Signature, Error>
fn try_sign_digest(&self, digest: D) -> Result<Signature, Error>
sourcefn sign_digest(&self, digest: D) -> S
fn sign_digest(&self, digest: D) -> S
sourceimpl<D> DigestSigner<D, Signature> for SigningKey where
D: Digest<OutputSize = UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>> + FixedOutput,
impl<D> DigestSigner<D, Signature> for SigningKey where
D: Digest<OutputSize = UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>> + FixedOutput,
sourcefn try_sign_digest(&self, msg_digest: D) -> Result<Signature, Error>
fn try_sign_digest(&self, msg_digest: D) -> Result<Signature, Error>
sourcefn sign_digest(&self, digest: D) -> S
fn sign_digest(&self, digest: D) -> S
sourceimpl<D> DigestSigner<D, Signature> for XPriv where
D: FixedOutput<OutputSize = U32> + Clone + Default + Reset + Update + HashMarker,
impl<D> DigestSigner<D, Signature> for XPriv where
D: FixedOutput<OutputSize = U32> + Clone + Default + Reset + Update + HashMarker,
sourcefn try_sign_digest(&self, digest: D) -> Result<Signature, Error>
fn try_sign_digest(&self, digest: D) -> Result<Signature, Error>
sourcefn sign_digest(&self, digest: D) -> S
fn sign_digest(&self, digest: D) -> S
sourceimpl<D> DigestVerifier<D, Signature> for DerivedPubkey where
D: Digest + FixedOutput<OutputSize = U32>,
impl<D> DigestVerifier<D, Signature> for DerivedPubkey where
D: Digest + FixedOutput<OutputSize = U32>,
sourceimpl<D> DigestVerifier<D, Signature> for DerivedXPub where
D: Digest + FixedOutput<OutputSize = U32>,
impl<D> DigestVerifier<D, Signature> for DerivedXPub where
D: Digest + FixedOutput<OutputSize = U32>,
sourceimpl<D> DigestVerifier<D, Signature> for VerifyingKey where
D: Digest<OutputSize = UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>> + FixedOutput,
impl<D> DigestVerifier<D, Signature> for VerifyingKey where
D: Digest<OutputSize = UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>> + FixedOutput,
sourceimpl<D> DigestVerifier<D, Signature> for XPub where
D: Digest + FixedOutput<OutputSize = U32>,
impl<D> DigestVerifier<D, Signature> for XPub where
D: Digest + FixedOutput<OutputSize = U32>,
sourceimpl<D> RandomizedDigestSigner<D, Signature> for SigningKey where
D: Digest<OutputSize = UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>> + FixedOutput,
impl<D> RandomizedDigestSigner<D, Signature> for SigningKey where
D: Digest<OutputSize = UInt<UInt<UInt<UInt<UInt<UInt<UTerm, B1>, B0>, B0>, B0>, B0>, B0>> + FixedOutput,
sourcefn try_sign_digest_with_rng(
&self,
rng: impl CryptoRng + RngCore,
msg_digest: D
) -> Result<Signature, Error>
fn try_sign_digest_with_rng(
&self,
rng: impl CryptoRng + RngCore,
msg_digest: D
) -> Result<Signature, Error>
Attempt to sign the given prehashed message Digest
, returning a
digital signature on success, or an error if something went wrong. Read more
sourcefn sign_digest_with_rng(&self, rng: impl CryptoRng + RngCore, digest: D) -> S
fn sign_digest_with_rng(&self, rng: impl CryptoRng + RngCore, digest: D) -> S
Sign the given prehashed message Digest
, returning a signature. Read more
impl Copy for Signature
impl Eq for Signature
impl StructuralEq for Signature
impl StructuralPartialEq for Signature
Auto Trait Implementations
impl RefUnwindSafe for Signature
impl Send for Signature
impl Sync for Signature
impl Unpin for Signature
impl UnwindSafe for Signature
Blanket Implementations
impl<T> Base32Len for T where
T: AsRef<[u8]>,
impl<T> Base32Len for T where
T: AsRef<[u8]>,
fn base32_len(&self) -> usize
fn base32_len(&self) -> usize
Calculate the base32 serialized length
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToHex for T where
T: AsRef<[u8]>,
impl<T> ToHex for T where
T: AsRef<[u8]>,
sourcefn encode_hex<U>(&self) -> U where
U: FromIterator<char>,
fn encode_hex<U>(&self) -> U where
U: FromIterator<char>,
Encode the hex strict representing self
into the result. Lower case
letters are used (e.g. f9b4ca
) Read more
sourcefn encode_hex_upper<U>(&self) -> U where
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> U where
U: FromIterator<char>,
Encode the hex strict representing self
into the result. Upper case
letters are used (e.g. F9B4CA
) Read more