pub struct PasswordWrapBlob {
pub version: u8,
pub nonce: [u8; 12],
pub ciphertext: Vec<u8>,
}Expand description
Parsed password-wrap blob.
Fields§
§version: u8§nonce: [u8; 12]§ciphertext: Vec<u8>32 bytes master key + 16 bytes GCM tag = 48 bytes.
Implementations§
Source§impl PasswordWrapBlob
impl PasswordWrapBlob
Sourcepub fn deserialize(data: &[u8]) -> Result<Self, AuthError>
pub fn deserialize(data: &[u8]) -> Result<Self, AuthError>
Deserialize from the binary format.
§Errors
Returns AuthError::InvalidBlob if the data is truncated or has an
unsupported version.
Sourcepub fn wrap(
master_key: &[u8],
kek_bytes: &mut [u8; 32],
) -> Result<Self, AuthError>
pub fn wrap( master_key: &[u8], kek_bytes: &mut [u8; 32], ) -> Result<Self, AuthError>
Create a new blob by wrapping a master key under a password-derived KEK.
kek_bytes must be 32 bytes (the Argon2id output). Zeroized after use.
§Errors
Returns an error if encryption fails or random nonce generation fails.
Sourcepub fn unwrap(&self, kek_bytes: &mut [u8; 32]) -> Result<SecureBytes, AuthError>
pub fn unwrap(&self, kek_bytes: &mut [u8; 32]) -> Result<SecureBytes, AuthError>
Unwrap the master key using a password-derived KEK.
kek_bytes must be 32 bytes (the Argon2id output). Zeroized after use.
§Errors
Returns AuthError::UnwrapFailed if the KEK is wrong (GCM auth fails).
Sourcepub fn path(config_dir: &Path, profile: &TrustProfileName) -> PathBuf
pub fn path(config_dir: &Path, profile: &TrustProfileName) -> PathBuf
Path to the password-wrap blob for a profile.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for PasswordWrapBlob
impl RefUnwindSafe for PasswordWrapBlob
impl Send for PasswordWrapBlob
impl Sync for PasswordWrapBlob
impl Unpin for PasswordWrapBlob
impl UnwindSafe for PasswordWrapBlob
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