Trait askar_crypto::alg::AnyKeyCreate [−][src]
pub trait AnyKeyCreate: Sized { fn generate(alg: KeyAlg, rng: impl KeyMaterial) -> 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> + ?Sized,
Pk: ?Sized; fn from_key_derivation(
alg: KeyAlg,
derive: impl KeyDerivation
) -> Result<Self, Error>; fn convert_key(&self, alg: KeyAlg) -> Result<Self, Error>; fn random(alg: KeyAlg) -> Result<Self, Error> { ... } fn random_det(alg: KeyAlg, seed: &[u8]) -> Result<Self, Error> { ... } }
Expand description
Create AnyKey instances from various sources
Required methods
Generate a new key from a key material generator for the given key algorithm.
Load a public key from its byte representation
Load a secret key or keypair from its byte representation
Convert from a concrete key instance
Create a new key instance from a key exchange
fn from_key_derivation(
alg: KeyAlg,
derive: impl KeyDerivation
) -> Result<Self, Error>
fn from_key_derivation(
alg: KeyAlg,
derive: impl KeyDerivation
) -> Result<Self, Error>
Create a new key instance from a key derivation
fn convert_key(&self, alg: KeyAlg) -> Result<Self, Error>
fn convert_key(&self, alg: KeyAlg) -> Result<Self, Error>
Derive the corresponding key for the provided key algorithm
Provided methods
Generate a new random key for the given key algorithm.