pub struct Kdf<Key: ByteArray<CRYPTO_KDF_KEYBYTES> + Zeroize, Context: ByteArray<CRYPTO_KDF_CONTEXTBYTES> + Zeroize> { /* 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> + Zeroize, Context: NewByteArray<CRYPTO_KDF_CONTEXTBYTES> + Zeroize> Kdf<Key, Context>
impl<Key: NewByteArray<CRYPTO_KDF_KEYBYTES> + Zeroize, Context: NewByteArray<CRYPTO_KDF_CONTEXTBYTES> + Zeroize> Kdf<Key, Context>
source§impl<Key: ByteArray<CRYPTO_KDF_KEYBYTES> + Zeroize, Context: ByteArray<CRYPTO_KDF_CONTEXTBYTES> + Zeroize> Kdf<Key, Context>
impl<Key: ByteArray<CRYPTO_KDF_KEYBYTES> + Zeroize, Context: ByteArray<CRYPTO_KDF_CONTEXTBYTES> + Zeroize> 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> + Zeroize, Context: Clone + ByteArray<CRYPTO_KDF_CONTEXTBYTES> + Zeroize> Clone for Kdf<Key, Context>
impl<Key: Clone + ByteArray<CRYPTO_KDF_KEYBYTES> + Zeroize, Context: Clone + ByteArray<CRYPTO_KDF_CONTEXTBYTES> + Zeroize> Clone for Kdf<Key, Context>
source§impl<Key: Debug + ByteArray<CRYPTO_KDF_KEYBYTES> + Zeroize, Context: Debug + ByteArray<CRYPTO_KDF_CONTEXTBYTES> + Zeroize> Debug for Kdf<Key, Context>
impl<Key: Debug + ByteArray<CRYPTO_KDF_KEYBYTES> + Zeroize, Context: Debug + ByteArray<CRYPTO_KDF_CONTEXTBYTES> + Zeroize> Debug for Kdf<Key, Context>
source§impl<'de, Key, Context> Deserialize<'de> for Kdf<Key, Context>where
Key: Deserialize<'de> + ByteArray<CRYPTO_KDF_KEYBYTES> + Zeroize,
Context: Deserialize<'de> + ByteArray<CRYPTO_KDF_CONTEXTBYTES> + Zeroize,
impl<'de, Key, Context> Deserialize<'de> for Kdf<Key, Context>where
Key: Deserialize<'de> + ByteArray<CRYPTO_KDF_KEYBYTES> + Zeroize,
Context: Deserialize<'de> + ByteArray<CRYPTO_KDF_CONTEXTBYTES> + Zeroize,
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
Auto Trait Implementations§
impl<Key, Context> Freeze for Kdf<Key, Context>
impl<Key, Context> RefUnwindSafe for Kdf<Key, Context>where
Key: RefUnwindSafe,
Context: RefUnwindSafe,
impl<Key, Context> Send for Kdf<Key, Context>
impl<Key, Context> Sync for Kdf<Key, Context>
impl<Key, Context> Unpin for Kdf<Key, Context>
impl<Key, Context> UnwindSafe for Kdf<Key, Context>where
Key: UnwindSafe,
Context: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)