pub struct Signature { /* private fields */ }
ecdsa-core
only.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
sourcepub fn recovery_id(self) -> Id
pub fn recovery_id(self) -> Id
Get the recovery Id
for this signature
sourcepub fn from_trial_recovery(
public_key: &VerifyingKey,
msg: &[u8],
signature: &Signature
) -> Result<Self>
This is supported on crate features ecdsa
and keccak256
only.
pub fn from_trial_recovery(
public_key: &VerifyingKey,
msg: &[u8],
signature: &Signature
) -> Result<Self>
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.
sourcepub fn from_digest_trial_recovery<D>(
public_key: &VerifyingKey,
digest: D,
signature: &Signature
) -> Result<Self> where
D: Clone + Digest<OutputSize = U32>,
This is supported on crate feature ecdsa
only.
pub fn from_digest_trial_recovery<D>(
public_key: &VerifyingKey,
digest: D,
signature: &Signature
) -> Result<Self> where
D: Clone + Digest<OutputSize = U32>,
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.
sourcepub fn recover_verify_key(&self, msg: &[u8]) -> Result<VerifyingKey>
This is supported on crate features ecdsa
and keccak256
only.
pub fn recover_verify_key(&self, msg: &[u8]) -> Result<VerifyingKey>
ecdsa
and keccak256
only.Recover the public key used to create the given signature as a
VerifyingKey
.
sourcepub fn recover_verify_key_from_digest<D>(
&self,
msg_digest: D
) -> Result<VerifyingKey> where
D: Digest<OutputSize = U32>,
This is supported on crate feature ecdsa
only.
pub fn recover_verify_key_from_digest<D>(
&self,
msg_digest: D
) -> Result<VerifyingKey> where
D: Digest<OutputSize = U32>,
ecdsa
only.Recover the public key used to create the given signature as a
VerifyingKey
from the provided precomputed [Digest
].
sourcepub fn recover_verify_key_from_digest_bytes(
&self,
digest_bytes: &FieldBytes
) -> Result<VerifyingKey>
This is supported on crate feature ecdsa
only.
pub fn recover_verify_key_from_digest_bytes(
&self,
digest_bytes: &FieldBytes
) -> Result<VerifyingKey>
ecdsa
only.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
This is supported on crate feature ecdsa
only.
pub fn r(&self) -> NonZeroScalar
ecdsa
only.Parse the r
component of this signature to a NonZeroScalar
sourcepub fn s(&self) -> NonZeroScalar
This is supported on crate feature ecdsa
only.
pub fn s(&self) -> NonZeroScalar
ecdsa
only.Parse the s
component of this signature to a NonZeroScalar
Trait Implementations
sourceimpl<D> DigestSigner<D, Signature> for SigningKey where
D: BlockInput + FixedOutput<OutputSize = U32> + Clone + Default + Reset + Update,
impl<D> DigestSigner<D, Signature> for SigningKey where
D: BlockInput + FixedOutput<OutputSize = U32> + Clone + Default + Reset + Update,
sourcefn try_sign_digest(&self, msg_digest: D) -> Result<Signature, Error>
fn try_sign_digest(&self, 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(&self, digest: D) -> S
fn sign_digest(&self, digest: D) -> S
Sign the given prehashed message [Digest
], returning a signature. Read more
sourceimpl<D> DigestVerifier<D, Signature> for VerifyingKey where
D: Digest<OutputSize = U32>,
impl<D> DigestVerifier<D, Signature> for VerifyingKey where
D: Digest<OutputSize = U32>,
sourceimpl PrehashSignature for Signature
impl PrehashSignature for Signature
sourceimpl<D> RandomizedDigestSigner<D, Signature> for SigningKey where
D: BlockInput + FixedOutput<OutputSize = U32> + Clone + Default + Reset + Update,
impl<D> RandomizedDigestSigner<D, Signature> for SigningKey where
D: BlockInput + FixedOutput<OutputSize = U32> + Clone + Default + Reset + Update,
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
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
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> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more