Struct ed25519_dalek::Signature
source · #[repr(C)]pub struct Signature { /* private fields */ }
Expand description
Ed25519 signature.
This type represents a container for the byte serialization of an Ed25519 signature, and does not necessarily represent well-formed field or curve elements.
Signature verification libraries are expected to reject invalid field elements at the time a signature is verified.
Implementations§
source§impl Signature
impl Signature
sourcepub fn from_bytes(bytes: &[u8; 64]) -> Signature
pub fn from_bytes(bytes: &[u8; 64]) -> Signature
Parse an Ed25519 signature from a byte slice.
sourcepub fn from_components(R: [u8; 32], s: [u8; 32]) -> Signature
pub fn from_components(R: [u8; 32], s: [u8; 32]) -> Signature
Parse an Ed25519 signature from its R
and s
components.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Signature
impl<'de> Deserialize<'de> for Signature
source§fn deserialize<D>(
deserializer: D
) -> Result<Signature, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D
) -> Result<Signature, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
source§impl<D> DigestSigner<D, Signature> for Context<'_, '_, SigningKey>
Available on crate feature digest
only.
impl<D> DigestSigner<D, Signature> for Context<'_, '_, SigningKey>
digest
only.Equivalent to SigningKey::sign_prehashed
with context
set to Some
containing self.value()
.
§Note
The RFC only permits SHA-512 to be used for prehashing. This function technically works, and is
probably safe to use, with any secure hash function with 512-bit digests, but anything outside
of SHA-512 is NOT specification-compliant. We expose crate::Sha512
for user convenience.
source§fn try_sign_digest(&self, msg_digest: D) -> Result<Signature, SignatureError>
fn try_sign_digest(&self, msg_digest: D) -> Result<Signature, SignatureError>
Digest
, returning a
digital signature on success, or an error if something went wrong.source§fn sign_digest(&self, digest: D) -> S
fn sign_digest(&self, digest: D) -> S
source§impl<D> DigestSigner<D, Signature> for SigningKey
Available on crate feature digest
only.
impl<D> DigestSigner<D, Signature> for SigningKey
digest
only.Equivalent to SigningKey::sign_prehashed
with context
set to None
.
§Note
The RFC only permits SHA-512 to be used for prehashing. This function technically works, and is
probably safe to use, with any secure hash function with 512-bit digests, but anything outside
of SHA-512 is NOT specification-compliant. We expose crate::Sha512
for user convenience.
source§fn try_sign_digest(&self, msg_digest: D) -> Result<Signature, SignatureError>
fn try_sign_digest(&self, msg_digest: D) -> Result<Signature, SignatureError>
Digest
, returning a
digital signature on success, or an error if something went wrong.source§fn sign_digest(&self, digest: D) -> S
fn sign_digest(&self, digest: D) -> S
source§impl<MsgDigest> DigestVerifier<MsgDigest, Signature> for Context<'_, '_, VerifyingKey>
Available on crate feature digest
only.
impl<MsgDigest> DigestVerifier<MsgDigest, Signature> for Context<'_, '_, VerifyingKey>
digest
only.Equivalent to VerifyingKey::verify_prehashed
with context
set to Some
containing self.value()
.
source§fn verify_digest(
&self,
msg_digest: MsgDigest,
signature: &Signature
) -> Result<(), SignatureError>
fn verify_digest( &self, msg_digest: MsgDigest, signature: &Signature ) -> Result<(), SignatureError>
Digest
output.source§impl<MsgDigest> DigestVerifier<MsgDigest, Signature> for VerifyingKey
Available on crate feature digest
only.
impl<MsgDigest> DigestVerifier<MsgDigest, Signature> for VerifyingKey
digest
only.Equivalent to VerifyingKey::verify_prehashed
with context
set to None
.
source§fn verify_digest(
&self,
msg_digest: MsgDigest,
signature: &Signature
) -> Result<(), SignatureError>
fn verify_digest( &self, msg_digest: MsgDigest, signature: &Signature ) -> Result<(), SignatureError>
Digest
output.source§impl FromStr for Signature
impl FromStr for Signature
Decode a signature from hexadecimal.
Upper and lower case hexadecimal are both accepted, however mixed case is rejected.