[−][src]Trait solana_libra_nextgen_crypto::traits::Signature
A type family for signature material that knows which public key type is needed to verify it, and given such a public key, knows how to verify.
This trait simply requires an association to some type of the
PublicKey
family of which we are the SignatureMaterial
.
It should be possible to write a generic signature function that
checks signature material passed as &[u8]
and only returns Ok when
that material de-serializes to a signature of the expected concrete
scheme. This would be done as an extension trait of
Signature
.
Associated Types
type VerifyingKeyMaterial: VerifyingKey<SignatureMaterial = Self>
The associated verifying key type for this signature.
type SigningKeyMaterial: SigningKey<SignatureMaterial = Self>
The associated signing key type for this signature
Required methods
fn verify(
&self,
message: &HashValue,
public_key: &Self::VerifyingKeyMaterial
) -> Result<()>
&self,
message: &HashValue,
public_key: &Self::VerifyingKeyMaterial
) -> Result<()>
The verification function.
fn verify_arbitrary_msg(
&self,
message: &[u8],
public_key: &Self::VerifyingKeyMaterial
) -> Result<()>
&self,
message: &[u8],
public_key: &Self::VerifyingKeyMaterial
) -> Result<()>
Native verification function.
fn to_bytes(&self) -> Vec<u8>
Convert the signature into a byte representation.
Provided methods
fn batch_verify_signatures(
message: &HashValue,
keys_and_signatures: Vec<(Self::VerifyingKeyMaterial, Self)>
) -> Result<()>
message: &HashValue,
keys_and_signatures: Vec<(Self::VerifyingKeyMaterial, Self)>
) -> Result<()>
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.
Implementors
impl Signature for BLS12381Signature
[src]
type VerifyingKeyMaterial = BLS12381PublicKey
type SigningKeyMaterial = BLS12381PrivateKey
fn verify(
&self,
message: &HashValue,
public_key: &BLS12381PublicKey
) -> Result<()>
[src]
&self,
message: &HashValue,
public_key: &BLS12381PublicKey
) -> Result<()>
Checks that signature
is valid for message
using public_key
.
fn verify_arbitrary_msg(
&self,
message: &[u8],
public_key: &BLS12381PublicKey
) -> Result<()>
[src]
&self,
message: &[u8],
public_key: &BLS12381PublicKey
) -> Result<()>
Checks that signature
is valid for an arbitrary &u8 message
using public_key
.
fn to_bytes(&self) -> Vec<u8>
[src]
impl Signature for Ed25519Signature
[src]
type VerifyingKeyMaterial = Ed25519PublicKey
type SigningKeyMaterial = Ed25519PrivateKey
fn verify(
&self,
message: &HashValue,
public_key: &Ed25519PublicKey
) -> Result<()>
[src]
&self,
message: &HashValue,
public_key: &Ed25519PublicKey
) -> Result<()>
Checks that self
is valid for message
using public_key
.
fn verify_arbitrary_msg(
&self,
message: &[u8],
public_key: &Ed25519PublicKey
) -> Result<()>
[src]
&self,
message: &[u8],
public_key: &Ed25519PublicKey
) -> Result<()>
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
fn batch_verify_signatures(
message: &HashValue,
keys_and_signatures: Vec<(Self::VerifyingKeyMaterial, Self)>
) -> Result<()>
[src]
message: &HashValue,
keys_and_signatures: Vec<(Self::VerifyingKeyMaterial, Self)>
) -> Result<()>
Batch signature verification as described in the original EdDSA article by Bernstein et al. "High-speed high-security signatures". Current implementation works for signatures on the same message and it checks for malleability.