[][src]Trait dup_crypto::keys::KeyPair

pub trait KeyPair: Clone + Display + Debug + PartialEq + Eq {
    type Signature: Signature;
    type PublicKey: PublicKey;
    type PrivateKey: PrivateKey;
    fn public_key(&self) -> Self::PublicKey;
fn private_key(&self) -> Self::PrivateKey;
fn sign(&self, message: &[u8]) -> Self::Signature;
fn verify(&self, message: &[u8], signature: &Self::Signature) -> bool; }

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

Associated Types

type Signature: Signature

Signature type of associated cryptosystem.

type PublicKey: PublicKey

PublicKey type of associated cryptosystem.

type PrivateKey: PrivateKey

PrivateKey type of associated cryptosystem.

Loading content...

Required methods

fn public_key(&self) -> Self::PublicKey

Get PublicKey

fn private_key(&self) -> Self::PrivateKey

Get PrivateKey

fn sign(&self, message: &[u8]) -> Self::Signature

Sign a message with private key.

fn verify(&self, message: &[u8], signature: &Self::Signature) -> bool

Verify a signature with public key.

Loading content...

Implementors

impl KeyPair for KeyPairEnum[src]

type Signature = Sig

type PublicKey = PubKey

type PrivateKey = PrivKey

impl KeyPair for KeyPair[src]

type Signature = Signature

type PublicKey = PublicKey

type PrivateKey = PrivateKey

Loading content...