KeyPair

Trait KeyPair 

Source
pub trait KeyPair:
    Clone
    + Display
    + Debug
    + KeyPairInner
    + PartialEq
    + Eq {
    type Seed: AsRef<[u8]>;
    type Signator: Signator;

    // Required methods
    fn generate_signator(&self) -> Self::Signator;
    fn from_seed(seed: Self::Seed) -> Self;
    fn public_key(&self) -> <Self::Signator as Signator>::PublicKey;
    fn verify(
        &self,
        message: &[u8],
        signature: &<<Self::Signator as Signator>::PublicKey as PublicKey>::Signature,
    ) -> Result<(), SigError>;
    fn upcast(self) -> KeyPairEnum;
}
Expand description

Define the operations that can be performed on a cryptographic key pair.

Required Associated Types§

Source

type Seed: AsRef<[u8]>

Seed

Source

type Signator: Signator

Signator type of associated cryptosystem.

Required Methods§

Source

fn generate_signator(&self) -> Self::Signator

Generate signator.

Source

fn from_seed(seed: Self::Seed) -> Self

Generate keypair from seed

Source

fn public_key(&self) -> <Self::Signator as Signator>::PublicKey

Get PublicKey

Source

fn verify( &self, message: &[u8], signature: &<<Self::Signator as Signator>::PublicKey as PublicKey>::Signature, ) -> Result<(), SigError>

Verify a signature with public key.

Source

fn upcast(self) -> KeyPairEnum

Upcast to KeyPairEnum

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§