Trait askar_crypto::alg::AnyKeyCreate[][src]

pub trait AnyKeyCreate: Sized {
    fn generate(alg: KeyAlg) -> Result<Self, Error>;
fn from_seed(alg: KeyAlg, seed: Seed<'_>) -> Result<Self, Error>;
fn from_public_bytes(alg: KeyAlg, public: &[u8]) -> Result<Self, Error>;
fn from_secret_bytes(alg: KeyAlg, secret: &[u8]) -> Result<Self, Error>;
fn from_key<K: HasKeyAlg + Send + Sync + 'static>(key: K) -> Self;
fn from_key_exchange<Sk: ?Sized, Pk>(
        alg: KeyAlg,
        secret: &Sk,
        public: &Pk
    ) -> Result<Self, Error>
    where
        Sk: KeyExchange<Pk>,
        Pk: ?Sized
;
fn from_key_derivation(
        alg: KeyAlg,
        derive: impl KeyDerivation
    ) -> Result<Self, Error>;
fn convert_key(&self, alg: KeyAlg) -> Result<Self, Error>; }
Expand description

Create AnyKey instances from various sources

Required methods

fn generate(alg: KeyAlg) -> Result<Self, Error>[src]

Expand description

Generate a new random key for the given key algorithm.

fn from_seed(alg: KeyAlg, seed: Seed<'_>) -> Result<Self, Error>[src]

Expand description

Generate a new deterministic key for the given key algorithm.

fn from_public_bytes(alg: KeyAlg, public: &[u8]) -> Result<Self, Error>[src]

Expand description

Load a public key from its byte representation

fn from_secret_bytes(alg: KeyAlg, secret: &[u8]) -> Result<Self, Error>[src]

Expand description

Load a secret key or keypair from its byte representation

fn from_key<K: HasKeyAlg + Send + Sync + 'static>(key: K) -> Self[src]

Expand description

Convert from a concrete key instance

fn from_key_exchange<Sk: ?Sized, Pk>(
    alg: KeyAlg,
    secret: &Sk,
    public: &Pk
) -> Result<Self, Error> where
    Sk: KeyExchange<Pk>,
    Pk: ?Sized
[src]

Expand description

Create a new key instance from a key exchange

fn from_key_derivation(
    alg: KeyAlg,
    derive: impl KeyDerivation
) -> Result<Self, Error>
[src]

Expand description

Create a new key instance from a key derivation

fn convert_key(&self, alg: KeyAlg) -> Result<Self, Error>[src]

Expand description

Derive the corresponding key for the provided key algorithm

Loading content...

Implementations on Foreign Types

impl AnyKeyCreate for Box<AnyKey>[src]

fn generate(alg: KeyAlg) -> Result<Self, Error>[src]

fn from_seed(alg: KeyAlg, seed: Seed<'_>) -> Result<Self, Error>[src]

fn from_public_bytes(alg: KeyAlg, public: &[u8]) -> Result<Self, Error>[src]

fn from_secret_bytes(alg: KeyAlg, secret: &[u8]) -> Result<Self, Error>[src]

fn from_key<K: HasKeyAlg + Send + Sync + 'static>(key: K) -> Self[src]

fn from_key_exchange<Sk: ?Sized, Pk>(
    alg: KeyAlg,
    secret: &Sk,
    public: &Pk
) -> Result<Self, Error> where
    Sk: KeyExchange<Pk>,
    Pk: ?Sized
[src]

fn from_key_derivation(
    alg: KeyAlg,
    derive: impl KeyDerivation
) -> Result<Self, Error>
[src]

fn convert_key(&self, alg: KeyAlg) -> Result<Self, Error>[src]

impl AnyKeyCreate for Arc<AnyKey>[src]

fn generate(alg: KeyAlg) -> Result<Self, Error>[src]

fn from_seed(alg: KeyAlg, seed: Seed<'_>) -> Result<Self, Error>[src]

fn from_public_bytes(alg: KeyAlg, public: &[u8]) -> Result<Self, Error>[src]

fn from_secret_bytes(alg: KeyAlg, secret: &[u8]) -> Result<Self, Error>[src]

fn from_key<K: HasKeyAlg + Send + Sync + 'static>(key: K) -> Self[src]

fn from_key_exchange<Sk: ?Sized, Pk>(
    alg: KeyAlg,
    secret: &Sk,
    public: &Pk
) -> Result<Self, Error> where
    Sk: KeyExchange<Pk>,
    Pk: ?Sized
[src]

fn from_key_derivation(
    alg: KeyAlg,
    derive: impl KeyDerivation
) -> Result<Self, Error>
[src]

fn convert_key(&self, alg: KeyAlg) -> Result<Self, Error>[src]

Loading content...

Implementors

Loading content...