KeyPair

Trait KeyPair 

Source
pub trait KeyPair:
    Sized
    + From<Self::PrivKey>
    + Signer<Self::Sig>
    + EncodeDecodeBase64
    + FromStr {
    type PubKey: VerifyingKey<PrivKey = Self::PrivKey, Sig = Self::Sig>;
    type PrivKey: SigningKey<PubKey = Self::PubKey, Sig = Self::Sig>;
    type Sig: Authenticator<PubKey = Self::PubKey, PrivKey = Self::PrivKey>;

    // Required methods
    fn public(&self) -> &Self::PubKey;
    fn private(self) -> Self::PrivKey;
    fn generate<R: AllowedRng>(rng: &mut R) -> Self;
}
Expand description

Trait impl’d by a public / private key pair in asymmetric cryptography.

Required Associated Types§

Source

type PubKey: VerifyingKey<PrivKey = Self::PrivKey, Sig = Self::Sig>

Source

type PrivKey: SigningKey<PubKey = Self::PubKey, Sig = Self::Sig>

Source

type Sig: Authenticator<PubKey = Self::PubKey, PrivKey = Self::PrivKey>

Required Methods§

Source

fn public(&self) -> &Self::PubKey

Get the public key.

Source

fn private(self) -> Self::PrivKey

Get the private key.

Source

fn generate<R: AllowedRng>(rng: &mut R) -> Self

Generate a new keypair using the given RNG.

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§