pub enum KeyDerivation {
Raw = 0,
HkdfSha256 = 1,
Pbkdf2Sha256 = 2,
}Expand description
The key derivation functions (KDFs) known by PZip.
Encapsulates the tags needed for each KDF along with a common derive method.
Variants§
Implementations§
Source§impl KeyDerivation
impl KeyDerivation
Sourcepub fn from(num: u8) -> Result<KeyDerivation, Error>
pub fn from(num: u8) -> Result<KeyDerivation, Error>
Returns a KeyDerivation for the specified u8 if known, otherwise
Error::UnknownKeyDerivation.
Returns the PZipTags to be used for new PZip files using
this key derivation.
Generally, this should return suitable random defaults for any derivation
parameters. Specifically, for HKDF, this returns a
Tag::Salt with a number of random bytes equal to
the hash length. For PBKDF2, this returns a similar
Tag::Salt as well as a
Tag::Iterations specifying the number of
PBKDF2 rounds.
Sourcepub fn derive(
&self,
material: &[u8],
algorithm: Algorithm,
tags: &PZipTags,
) -> Result<Vec<u8>, Error>
pub fn derive( &self, material: &[u8], algorithm: Algorithm, tags: &PZipTags, ) -> Result<Vec<u8>, Error>
Derives key bytes from input key material for the specified
Algorithm, using parameters found in tags.
The number of bytes returned depends on the length of the key expected by the algorithm.
Trait Implementations§
Source§impl Clone for KeyDerivation
impl Clone for KeyDerivation
Source§fn clone(&self) -> KeyDerivation
fn clone(&self) -> KeyDerivation
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more