Struct k256::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§
source§impl 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_digest_trial_recovery<D>(
public_key: &VerifyingKey,
digest: D,
signature: &Signature
) -> Result<Self>where
D: Clone + Digest<OutputSize = U32>,
pub fn from_digest_trial_recovery<D>(
public_key: &VerifyingKey,
digest: D,
signature: &Signature
) -> Result<Self>where
D: Clone + Digest<OutputSize = U32>,
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_from_digest<D>(
&self,
msg_digest: D
) -> Result<VerifyingKey>where
D: Digest<OutputSize = U32>,
pub fn recover_verify_key_from_digest<D>(
&self,
msg_digest: D
) -> Result<VerifyingKey>where
D: Digest<OutputSize = U32>,
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>
pub fn recover_verify_key_from_digest_bytes(
&self,
digest_bytes: &FieldBytes
) -> Result<VerifyingKey>
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
pub fn r(&self) -> NonZeroScalar
Parse the r
component of this signature to a NonZeroScalar
sourcepub fn s(&self) -> NonZeroScalar
pub fn s(&self) -> NonZeroScalar
Parse the s
component of this signature to a NonZeroScalar