pub struct DerivedKey { /* private fields */ }
Expand description
A key that has been derived from a RootKey
This will have an encryption key and an hmac key derived from the RootKey
’s entropy pool, using
Blake3 in key-derivation mode, keyed with the RootKey
’s hmac key.
This struct also contains the context string that was used to derive it, as a way to validate key provenance, or possibly reconstruct a key after a corruption occurs.
Implementations§
Source§impl DerivedKey
impl DerivedKey
Sourcepub fn encrypt(
&self,
root_key: &RootKey,
) -> Result<EncryptedDerivedKey<'static>, BackendError>
pub fn encrypt( &self, root_key: &RootKey, ) -> Result<EncryptedDerivedKey<'static>, BackendError>
Encrypts the given DerivedKey
into an EncryptedDerivedKey
using the given RootKey
.
This method packs the derived key into a ClearText
box, and then encrypts it to a CipherText
box, without enabling compression.
See the documentation for CipherText
for a description of the encryption method.
§Errors
Will error if the encryption or serialization fail
Trait Implementations§
Source§impl Clone for DerivedKey
impl Clone for DerivedKey
Source§fn clone(&self) -> DerivedKey
fn clone(&self) -> DerivedKey
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<'de> Deserialize<'de> for DerivedKey
impl<'de> Deserialize<'de> for DerivedKey
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
Source§impl Drop for DerivedKey
impl Drop for DerivedKey
Source§impl Hash for DerivedKey
impl Hash for DerivedKey
Source§impl Key for DerivedKey
impl Key for DerivedKey
Source§impl Serialize for DerivedKey
impl Serialize for DerivedKey
Auto Trait Implementations§
impl Freeze for DerivedKey
impl RefUnwindSafe for DerivedKey
impl Send for DerivedKey
impl Sync for DerivedKey
impl Unpin for DerivedKey
impl UnwindSafe for DerivedKey
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