pub struct Kdf<Key: ByteArray<CRYPTO_KDF_KEYBYTES>, Context: ByteArray<CRYPTO_KDF_CONTEXTBYTES>> { /* private fields */ }
Expand description
Key derivation implementation based on Blake2b, compatible with libsodium’s
crypto_kdf_*
functions.
Implementations§
source§impl<Key: NewByteArray<CRYPTO_KDF_KEYBYTES>, Context: NewByteArray<CRYPTO_KDF_CONTEXTBYTES>> Kdf<Key, Context>
impl<Key: NewByteArray<CRYPTO_KDF_KEYBYTES>, Context: NewByteArray<CRYPTO_KDF_CONTEXTBYTES>> Kdf<Key, Context>
source§impl<Key: ByteArray<CRYPTO_KDF_KEYBYTES>, Context: ByteArray<CRYPTO_KDF_CONTEXTBYTES>> Kdf<Key, Context>
impl<Key: ByteArray<CRYPTO_KDF_KEYBYTES>, Context: ByteArray<CRYPTO_KDF_CONTEXTBYTES>> Kdf<Key, Context>
sourcepub fn derive_subkey<Subkey: NewByteArray<CRYPTO_KDF_KEYBYTES>>(
&self,
subkey_id: u64
) -> Result<Subkey, Error>
pub fn derive_subkey<Subkey: NewByteArray<CRYPTO_KDF_KEYBYTES>>(
&self,
subkey_id: u64
) -> Result<Subkey, Error>
Derives a subkey for subkey_id
, returning it.
sourcepub fn derive_subkey_to_vec(&self, subkey_id: u64) -> Result<Vec<u8>, Error>
pub fn derive_subkey_to_vec(&self, subkey_id: u64) -> Result<Vec<u8>, Error>
Derives a subkey for subkey_id
, returning it as a Vec
. Provided
for convenience.
sourcepub fn from_parts(main_key: Key, context: Context) -> Self
pub fn from_parts(main_key: Key, context: Context) -> Self
Constructs a new instance from key
and context
, consuming them both.
sourcepub fn into_parts(self) -> (Key, Context)
pub fn into_parts(self) -> (Key, Context)
Moves the key and context out of this instance, returning them as a tuple.
Trait Implementations§
source§impl<Key: Clone + ByteArray<CRYPTO_KDF_KEYBYTES>, Context: Clone + ByteArray<CRYPTO_KDF_CONTEXTBYTES>> Clone for Kdf<Key, Context>
impl<Key: Clone + ByteArray<CRYPTO_KDF_KEYBYTES>, Context: Clone + ByteArray<CRYPTO_KDF_CONTEXTBYTES>> Clone for Kdf<Key, Context>
source§impl<Key: Debug + ByteArray<CRYPTO_KDF_KEYBYTES>, Context: Debug + ByteArray<CRYPTO_KDF_CONTEXTBYTES>> Debug for Kdf<Key, Context>
impl<Key: Debug + ByteArray<CRYPTO_KDF_KEYBYTES>, Context: Debug + ByteArray<CRYPTO_KDF_CONTEXTBYTES>> Debug for Kdf<Key, Context>
source§impl<'de, Key, Context> Deserialize<'de> for Kdf<Key, Context>where
Key: Deserialize<'de> + ByteArray<CRYPTO_KDF_KEYBYTES>,
Context: Deserialize<'de> + ByteArray<CRYPTO_KDF_CONTEXTBYTES>,
impl<'de, Key, Context> Deserialize<'de> for Kdf<Key, Context>where
Key: Deserialize<'de> + ByteArray<CRYPTO_KDF_KEYBYTES>,
Context: Deserialize<'de> + ByteArray<CRYPTO_KDF_CONTEXTBYTES>,
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more