pub struct ECDSASignature {
pub signature: Signature,
pub recovery_id: RecoveryID,
}Expand description
An ECDSA/Secp256k1 signature (r,s) signature along with the recovery ID.
Fields§
§signature: SignatureThe (r,s) signature.
recovery_id: RecoveryIDThe recovery ID.
Implementations§
Source§impl ECDSASignature
impl ECDSASignature
Sourcepub const BASE_SIGNATURE_SIZE_IN_BYTES: usize = 64usize
pub const BASE_SIGNATURE_SIZE_IN_BYTES: usize = 64usize
The base signature size in bytes for secp256k1.
Sourcepub const ETHEREUM_ADDRESS_SIZE_IN_BYTES: usize = 20usize
pub const ETHEREUM_ADDRESS_SIZE_IN_BYTES: usize = 20usize
The size of an Ethereum address in bytes.
Sourcepub const PREHASH_SIZE_IN_BYTES: usize = 32usize
pub const PREHASH_SIZE_IN_BYTES: usize = 32usize
The prehash size in bytes for secp256k1.
Sourcepub const SIGNATURE_SIZE_IN_BYTES: usize = 65usize
pub const SIGNATURE_SIZE_IN_BYTES: usize = 65usize
The ECDSA Signature size in bits for secp256k1 (including the one-byte recovery ID).
Sourcepub const VERIFYING_KEY_SIZE_IN_BYTES: usize = 33usize
pub const VERIFYING_KEY_SIZE_IN_BYTES: usize = 33usize
The compressed VerifyingKey size in bytes for secp256k1 (32 byte field + one-byte header).
Sourcepub const fn recovery_id(&self) -> ECDSARecoveryId
pub const fn recovery_id(&self) -> ECDSARecoveryId
Returns the recovery ID.
Sourcepub fn sign<H: Hash<Output = Vec<bool>>>(
signing_key: &SigningKey,
hasher: &H,
message: &[H::Input],
) -> Result<Self>
pub fn sign<H: Hash<Output = Vec<bool>>>( signing_key: &SigningKey, hasher: &H, message: &[H::Input], ) -> Result<Self>
Returns a signature on a message using the given signing_key and hash function.
Sourcepub fn recover_public_key<H: Hash<Output = Vec<bool>>>(
&self,
hasher: &H,
message: &[H::Input],
) -> Result<VerifyingKey>
pub fn recover_public_key<H: Hash<Output = Vec<bool>>>( &self, hasher: &H, message: &[H::Input], ) -> Result<VerifyingKey>
Recover the public key from (r,s, recovery_id) using your hasher on message.
Sourcepub fn recover_public_key_with_digest(
&self,
digest_bits: &[bool],
) -> Result<VerifyingKey>
pub fn recover_public_key_with_digest( &self, digest_bits: &[bool], ) -> Result<VerifyingKey>
Recover the public key from (r,s, recovery_id) using your hasher on message.
Sourcepub fn verify<H: Hash<Output = Vec<bool>>>(
&self,
verifying_key: &VerifyingKey,
hasher: &H,
message: &[H::Input],
) -> Result<()>
pub fn verify<H: Hash<Output = Vec<bool>>>( &self, verifying_key: &VerifyingKey, hasher: &H, message: &[H::Input], ) -> Result<()>
Verify (r,s) against verifying_key using your hasher on message.
Sourcepub fn verify_with_digest(
&self,
verifying_key: &VerifyingKey,
digest_bits: &[bool],
) -> Result<()>
pub fn verify_with_digest( &self, verifying_key: &VerifyingKey, digest_bits: &[bool], ) -> Result<()>
Verify (r,s) against verifying_key using the provided digest.
Sourcepub fn verify_ethereum<H: Hash<Output = Vec<bool>>>(
&self,
ethereum_address: &[u8; 20],
hasher: &H,
message: &[H::Input],
) -> Result<()>
pub fn verify_ethereum<H: Hash<Output = Vec<bool>>>( &self, ethereum_address: &[u8; 20], hasher: &H, message: &[H::Input], ) -> Result<()>
Verify (r,s) against verifying_key using your hasher on message.
Sourcepub fn verify_ethereum_with_digest(
&self,
ethereum_address: &[u8; 20],
digest_bits: &[bool],
) -> Result<()>
pub fn verify_ethereum_with_digest( &self, ethereum_address: &[u8; 20], digest_bits: &[bool], ) -> Result<()>
Verify (r,s) against verifying_key using your hasher on message.
Sourcepub fn ethereum_address_from_public_key(
verifying_key: &VerifyingKey,
) -> Result<[u8; 20]>
pub fn ethereum_address_from_public_key( verifying_key: &VerifyingKey, ) -> Result<[u8; 20]>
Converts a VerifyingKey to an Ethereum address (20 bytes).
Sourcepub fn verifying_key_from_bytes(bytes: &[u8]) -> Result<VerifyingKey>
pub fn verifying_key_from_bytes(bytes: &[u8]) -> Result<VerifyingKey>
Parses a verifying key from bytes.
Trait Implementations§
Source§impl Clone for ECDSASignature
impl Clone for ECDSASignature
Source§fn clone(&self) -> ECDSASignature
fn clone(&self) -> ECDSASignature
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for ECDSASignature
impl Debug for ECDSASignature
Source§impl<'de> Deserialize<'de> for ECDSASignature
impl<'de> Deserialize<'de> for ECDSASignature
Source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserializes the signature from a string or bytes.
Source§impl Display for ECDSASignature
impl Display for ECDSASignature
Source§impl FromBytes for ECDSASignature
impl FromBytes for ECDSASignature
Source§fn read_le<R: Read>(reader: R) -> IoResult<Self>
fn read_le<R: Read>(reader: R) -> IoResult<Self>
Self from reader as little-endian bytes.Source§fn from_bytes_le(bytes: &[u8]) -> Result<Self, Error>where
Self: Sized,
fn from_bytes_le(bytes: &[u8]) -> Result<Self, Error>where
Self: Sized,
Self from a byte array in little-endian order.Source§fn from_bytes_le_unchecked(bytes: &[u8]) -> Result<Self, Error>where
Self: Sized,
fn from_bytes_le_unchecked(bytes: &[u8]) -> Result<Self, Error>where
Self: Sized,
Self::from_bytes_le but avoids costly checks.
This shall only be called when deserializing from a trusted source, such as local storage. Read moreSource§fn read_le_unchecked<R>(reader: R) -> Result<Self, Error>
fn read_le_unchecked<R>(reader: R) -> Result<Self, Error>
Self::read_le but avoids costly checks.
This shall only be called when deserializing from a trusted source, such as local storage. Read moreSource§impl FromStr for ECDSASignature
impl FromStr for ECDSASignature
Source§impl PartialEq for ECDSASignature
impl PartialEq for ECDSASignature
Source§impl Serialize for ECDSASignature
impl Serialize for ECDSASignature
Source§impl ToBytes for ECDSASignature
impl ToBytes for ECDSASignature
impl Eq for ECDSASignature
impl StructuralPartialEq for ECDSASignature
Auto Trait Implementations§
impl Freeze for ECDSASignature
impl RefUnwindSafe for ECDSASignature
impl Send for ECDSASignature
impl Sync for ECDSASignature
impl Unpin for ECDSASignature
impl UnwindSafe for ECDSASignature
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<'de, T> DeserializeExt<'de> for Twhere
T: DeserializeOwned,
impl<'de, T> DeserializeExt<'de> for Twhere
T: DeserializeOwned,
fn take_from_value<D>(
value: &mut Value,
field: &str,
) -> Result<T, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more