#[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: &SignatureBytes) -> Self
pub fn from_bytes(bytes: &SignatureBytes) -> Self
Parse an Ed25519 signature from a byte slice.
sourcepub fn from_components(R: ComponentBytes, s: ComponentBytes) -> Self
pub fn from_components(R: ComponentBytes, s: ComponentBytes) -> Self
Parse an Ed25519 signature from its R
and s
components.
sourcepub fn from_slice(bytes: &[u8]) -> Result<Self>
pub fn from_slice(bytes: &[u8]) -> Result<Self>
Parse an Ed25519 signature from a byte slice.
Returns
Ok
on successErr
if the input byte slice is not 64-bytes
sourcepub fn r_bytes(&self) -> &ComponentBytes
pub fn r_bytes(&self) -> &ComponentBytes
Bytes for the R
component of a signature.
sourcepub fn s_bytes(&self) -> &ComponentBytes
pub fn s_bytes(&self) -> &ComponentBytes
Bytes for the s
component of a signature.
sourcepub fn to_bytes(&self) -> SignatureBytes
pub fn to_bytes(&self) -> SignatureBytes
Return the inner byte array.
Trait Implementations§
source§impl<'de> Deserialize<'de> for Signature
Available on crate feature serde
only.
impl<'de> Deserialize<'de> for Signature
Available on crate feature
serde
only.source§fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Self, D::Error>
Deserialize this value from the given Serde deserializer. Read more
source§impl<'de> Deserialize<'de> for Signature
Available on crate features serde
and serde_bytes
only.
impl<'de> Deserialize<'de> for Signature
Available on crate features
serde
and serde_bytes
only.fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
source§impl From<&[u8; 64]> for Signature
impl From<&[u8; 64]> for Signature
source§fn from(bytes: &SignatureBytes) -> Self
fn from(bytes: &SignatureBytes) -> Self
Converts to this type from the input type.
source§impl From<&Signature> for SignatureBytes
impl From<&Signature> for SignatureBytes
source§fn from(sig: &Signature) -> SignatureBytes
fn from(sig: &Signature) -> SignatureBytes
Converts to this type from the input type.
source§impl From<[u8; 64]> for Signature
impl From<[u8; 64]> for Signature
source§fn from(bytes: SignatureBytes) -> Self
fn from(bytes: SignatureBytes) -> Self
Converts to this type from the input type.
source§impl From<Signature> for SignatureBytes
impl From<Signature> for SignatureBytes
source§fn from(sig: Signature) -> SignatureBytes
fn from(sig: Signature) -> SignatureBytes
Converts to this type from the input type.
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.