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
sourceimpl<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>
sourceimpl<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
sourceimpl<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>
sourceimpl<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>
sourceimpl<'de, Key: ByteArray<CRYPTO_KDF_KEYBYTES>, Context: ByteArray<CRYPTO_KDF_CONTEXTBYTES>> Deserialize<'de> for Kdf<Key, Context>where
Key: Deserialize<'de>,
Context: Deserialize<'de>,
impl<'de, Key: ByteArray<CRYPTO_KDF_KEYBYTES>, Context: ByteArray<CRYPTO_KDF_CONTEXTBYTES>> Deserialize<'de> for Kdf<Key, Context>where
Key: Deserialize<'de>,
Context: Deserialize<'de>,
sourcefn 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
sourceimpl<Key: ByteArray<CRYPTO_KDF_KEYBYTES>, Context: ByteArray<CRYPTO_KDF_CONTEXTBYTES>> Serialize for Kdf<Key, Context>where
Key: Serialize,
Context: Serialize,
impl<Key: ByteArray<CRYPTO_KDF_KEYBYTES>, Context: ByteArray<CRYPTO_KDF_CONTEXTBYTES>> Serialize for Kdf<Key, Context>where
Key: Serialize,
Context: Serialize,
Auto Trait Implementations
impl<Key, Context> RefUnwindSafe for Kdf<Key, Context>where
Context: RefUnwindSafe,
Key: RefUnwindSafe,
impl<Key, Context> Send for Kdf<Key, Context>where
Context: Send,
Key: Send,
impl<Key, Context> Sync for Kdf<Key, Context>where
Context: Sync,
Key: Sync,
impl<Key, Context> Unpin for Kdf<Key, Context>where
Context: Unpin,
Key: Unpin,
impl<Key, Context> UnwindSafe for Kdf<Key, Context>where
Context: UnwindSafe,
Key: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more