Trait ExternallySigned

Source
pub trait ExternallySigned<T>: Sized {
    type Key: ?Sized;
    type KeyHint;
    type Error;

    // Required methods
    fn key_is_correct(&self, k: &Self::Key) -> Result<(), Self::KeyHint>;
    fn is_well_signed(&self, k: &Self::Key) -> Result<(), Self::Error>;
    fn dangerously_assume_wellsigned(self) -> T;

    // Provided method
    fn check_signature(self, k: &Self::Key) -> Result<T, Self::Error> { ... }
}
Expand description

A cryptographically signed object that needs an external public key to validate it.

Required Associated Types§

Source

type Key: ?Sized

The type of the public key object.

You can use a tuple or a vector here if the object is signed with multiple keys.

Source

type KeyHint

A type that describes what keys are missing for this object.

Source

type Error

An error type that’s returned when the object is not well-signed.

Required Methods§

Source

fn key_is_correct(&self, k: &Self::Key) -> Result<(), Self::KeyHint>

Check whether k is the right key for this object. If not, return an error describing what key would be right.

This function is allowed to return ‘true’ for a bad key, but never ‘false’ for a good key.

Source

fn is_well_signed(&self, k: &Self::Key) -> Result<(), Self::Error>

Check the signature on this object

Source

fn dangerously_assume_wellsigned(self) -> T

Unwrap this object without checking any signatures on it.

Provided Methods§

Source

fn check_signature(self, k: &Self::Key) -> Result<T, Self::Error>

Unwrap this object if it’s correctly signed by a provided key.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

impl ExternallySigned<TimerangeBound<RsaCrosscert>> for UncheckedRsaCrosscert

impl<RS> ExternallySigned<Consensus<RS>> for UnvalidatedConsensus<RS>