Type Alias dryoc::kdf::protected::LockedKdf

source ·
pub type LockedKdf = Kdf<Locked<Key>, Locked<Context>>;
Available on crate feature nightly only.
Expand description

Locked Kdf, provided as a type alias for convenience.

Aliased Type§

struct LockedKdf { /* private fields */ }

Implementations

source§

impl<Key: NewByteArray<CRYPTO_KDF_KEYBYTES> + Zeroize, Context: NewByteArray<CRYPTO_KDF_CONTEXTBYTES> + Zeroize> Kdf<Key, Context>

source

pub fn gen() -> Self

Randomly generates a new pair of main key and context.

source§

impl<Key: ByteArray<CRYPTO_KDF_KEYBYTES> + Zeroize, Context: ByteArray<CRYPTO_KDF_CONTEXTBYTES> + Zeroize> Kdf<Key, Context>

source

pub fn derive_subkey<Subkey: NewByteArray<CRYPTO_KDF_KEYBYTES>>( &self, subkey_id: u64 ) -> Result<Subkey, Error>

Derives a subkey for subkey_id, returning it.

source

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.

source

pub fn from_parts(main_key: Key, context: Context) -> Self

Constructs a new instance from key and context, consuming them both.

source

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>

source§

fn clone(&self) -> Kdf<Key, Context>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<Key: Debug + ByteArray<CRYPTO_KDF_KEYBYTES> + Zeroize, Context: Debug + ByteArray<CRYPTO_KDF_CONTEXTBYTES> + Zeroize> Debug for Kdf<Key, Context>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
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,

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl<Key, Context> Serialize for Kdf<Key, Context>
where Key: Serialize + ByteArray<CRYPTO_KDF_KEYBYTES> + Zeroize, Context: Serialize + ByteArray<CRYPTO_KDF_CONTEXTBYTES> + Zeroize,

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl<Key, Context> Zeroize for Kdf<Key, Context>
where Key: Zeroize + ByteArray<CRYPTO_KDF_KEYBYTES>, Context: Zeroize + ByteArray<CRYPTO_KDF_CONTEXTBYTES>,

source§

fn zeroize(&mut self)

Zero out this object from memory using Rust intrinsics which ensure the zeroization operation is not “optimized away” by the compiler.