Skip to main content

MasterSecret

Struct MasterSecret 

Source
pub struct MasterSecret { /* private fields */ }
Expand description

The vault-level KDF output. Derive ONCE per open (the expensive step), then zeroize the passphrase — every other key HKDF-derives from this (spec §4.3). Carries the salt it was derived under so entry/mac/registry keys need no extra context.

Implementations§

Source§

impl MasterSecret

Source

pub fn derive(passphrase: &str, salt: &[u8; 16]) -> Self

PBKDF2-HMAC-SHA256 @ 600k over the passphrase. The caller should drop (zeroize) the passphrase immediately after this returns.

Source

pub fn from_raw_key(key: &[u8; 32], salt: &[u8; 16]) -> Self

Wrap an already-random 32-byte key as the master secret (the lease path, LEASE_DESIGN.md §4). A full-entropy key needs no stretching, so PBKDF2 is skipped; every HKDF derivation downstream (entry keys, manifest MAC) is identical to the passphrase path, and the container format is byte-for-byte the same QVLT v2.

Source

pub fn salt(&self) -> &[u8; 16]

Source

pub fn registry_key(&self) -> Zeroizing<[u8; 32]>

Key for the raw-key registry container (spec §6.2).

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.