[][src]Trait mundane::public::Signature

pub trait Signature: Sealed + Sized {
    type PrivateKey: PrivateKey;
#[must_use]
    fn sign(key: &Self::PrivateKey, message: &[u8]) -> Result<Self, Error>;
#[must_use] fn is_valid(
        &self,
        key: &<Self::PrivateKey as PrivateKey>::Public,
        message: &[u8]
    ) -> bool; }

A cryptographic signature generated by a private key.

Associated Types

type PrivateKey: PrivateKey

The private key type used to generate this signature.

Loading content...

Required methods

#[must_use] fn sign(key: &Self::PrivateKey, message: &[u8]) -> Result<Self, Error>

Sign a message.

The input to this function is always a message, never a digest. If a signature scheme calls for hashing a message and signing the hash digest, sign is responsible for both hashing and signing.

#[must_use] fn is_valid(
    &self,
    key: &<Self::PrivateKey as PrivateKey>::Public,
    message: &[u8]
) -> bool

Verify a signature.

The input to this function is always a message, never a digest. If a signature scheme calls for hashing a message and signing the hash digest, is_valid is responsible for both hashing and verifying the digest.

Loading content...

Implementors

impl Signature for Ed25519Signature[src]

type PrivateKey = Ed25519PrivKey

fn sign(key: &Ed25519PrivKey, message: &[u8]) -> Result<Ed25519Signature, Error>[src]

Sign a message.

Though the Signature trait requires that sign return a Result, Ed25519Signature's implementation is guaranteed to always return Ok. Callers may prefer the sign_ed25519 function, which returns an Ed25519Signature rather than a Result.

impl<B: RsaKeyBits, S: RsaSignatureScheme, H: Hasher> Signature for RsaSignature<B, S, H>[src]

type PrivateKey = RsaPrivKey<B>

impl<C: PCurve, H: Hasher + EcdsaHash<C>> Signature for EcdsaSignature<C, H>[src]

type PrivateKey = EcPrivKey<C>

Loading content...