Struct diem_sdk::crypto::ed25519::Ed25519Signature [−][src]
pub struct Ed25519Signature(_);
Expand description
An Ed25519 signature
Implementations
Check for correct size and third-party based signature malleability issues. This method is required to ensure that given a valid signature for some message under some key, an attacker cannot produce another valid signature for the same message and key.
According to RFC8032, signatures comprise elements {R, S} and we should enforce that S is of canonical form (smaller than L, where L is the order of edwards25519 curve group) to prevent signature malleability. Without this check, one could add a multiple of L into S and still pass signature verification, resulting in a distinct yet valid signature.
This method does not check the R component of the signature, because R is hashed during signing and verification to compute h = H(ENC(R) || ENC(A) || M), which means that a third-party cannot modify R without being detected.
Note: It’s true that malicious signers can already produce varying signatures by choosing a different nonce, so this method protects against malleability attacks performed by a non-signer.
Trait Implementations
pub fn deserialize<D>(
deserializer: D
) -> Result<Ed25519Signature, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
pub fn deserialize<D>(
deserializer: D
) -> Result<Ed25519Signature, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Performs the conversion.
pub fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
pub fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
pub fn verify<T>(
&self,
message: &T,
public_key: &Ed25519PublicKey
) -> Result<(), Error> where
T: CryptoHash + Serialize,
pub fn verify<T>(
&self,
message: &T,
public_key: &Ed25519PublicKey
) -> Result<(), Error> where
T: CryptoHash + Serialize,
Verifies that the provided signature is valid for the provided message, according to the RFC8032 algorithm. This strict verification performs the recommended check of 5.1.7 §3, on top of the required RFC8032 verifications.
pub fn verify_arbitrary_msg(
&self,
message: &[u8],
public_key: &Ed25519PublicKey
) -> Result<(), Error>
pub fn verify_arbitrary_msg(
&self,
message: &[u8],
public_key: &Ed25519PublicKey
) -> Result<(), Error>
Checks that self
is valid for an arbitrary &u8 message
using public_key
.
Outside of this crate, this particular function should only be used for native signature
verification in move
The associated verifying key type for this signature.
The associated signing key type for this signature
fn batch_verify<T>(
message: &T,
keys_and_signatures: Vec<(Self::VerifyingKeyMaterial, Self), Global>
) -> Result<(), Error> where
T: CryptoHash + Serialize,
fn batch_verify<T>(
message: &T,
keys_and_signatures: Vec<(Self::VerifyingKeyMaterial, Self), Global>
) -> Result<(), Error> where
T: CryptoHash + Serialize,
The implementer can override a batch verification implementation that by default iterates over each signature. More efficient implementations exist and should be implemented for many schemes. Read more
type Error = CryptoMaterialError
type Error = CryptoMaterialError
The type returned in the event of a conversion error.
Performs the conversion.
Auto Trait Implementations
impl RefUnwindSafe for Ed25519Signature
impl Send for Ed25519Signature
impl Sync for Ed25519Signature
impl Unpin for Ed25519Signature
impl UnwindSafe for Ed25519Signature
Blanket Implementations
Mutably borrows from an owned value. Read more
Compare self to key
and return true
if they are equal.
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
Generates a hash used only for tests.
pub fn vzip(self) -> V
When trying to convert from bytes, we simply decode the string into bytes before checking if we can convert. Read more
A function to encode into hex-string after serializing.
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more