Trait snarkvm_algorithms::traits::signature::SignatureScheme
source · [−]pub trait SignatureScheme: Sized + ToBytes + FromBytes + Debug + Clone + Eq + Send + Sync + From<Self::Parameters> {
type Parameters: Clone + Debug + Eq;
type PublicKey: Clone + Debug + Default + ToBytes + FromBytes + Hash + Eq + Send + Sync;
type PrivateKey: Clone + Debug + Default + ToBytes + FromBytes + PartialEq + Eq;
type Signature: Clone + Debug + Default + ToBytes + FromBytes + Send + Sync + PartialEq + Eq;
fn setup(message: &str) -> Self;
fn parameters(&self) -> &Self::Parameters;
fn generate_private_key<R: Rng + CryptoRng>(
&self,
rng: &mut R
) -> Self::PrivateKey;
fn generate_public_key(
&self,
private_key: &Self::PrivateKey
) -> Self::PublicKey;
fn sign<R: Rng + CryptoRng>(
&self,
private_key: &Self::PrivateKey,
message: &[u8],
rng: &mut R
) -> Result<Self::Signature>;
fn verify(
&self,
public_key: &Self::PublicKey,
message: &[u8],
signature: &Self::Signature
) -> Result<bool>;
}