pub struct KeyData {
pub salt: Vec<u8>,
pub key_encrypted: Option<Vec<u8>>,
pub info_encrypted: Vec<u8>,
pub trailer: Option<KeyDataTrailer>,
}Expand description
The decoded payload of a key file.
Fields§
§salt: Vec<u8>The open salt, LOCAL_ENCRYPT_SALT_SIZE bytes.
key_encrypted: Option<Vec<u8>>The open wrap of the local key; None when stored as a null array,
which 7.3 writes while the app lock is on.
info_encrypted: Vec<u8>The accounts info encrypted under the local key.
trailer: Option<KeyDataTrailer>The 7.3 trailer; None for the legacy three-blob layout.
Implementations§
Source§impl KeyData
impl KeyData
Sourcepub fn parse(payload: &[u8]) -> Result<Self>
pub fn parse(payload: &[u8]) -> Result<Self>
Decodes a key file payload (the bytes inside its TDF$ container).
§Errors
Error::QDataStreamFailedwhen a blob is cut short.Error::KeyDataInvalidwhen the salt is notLOCAL_ENCRYPT_SALT_SIZEbytes or the trailer is malformed (seeKeyDataTrailer::parse).
Sourcepub fn encode(&self) -> Result<Vec<u8>>
pub fn encode(&self) -> Result<Vec<u8>>
Encodes the key file payload; a trailer is written in format
KEY_DATA_FORMAT_VERSION.
§Errors
Error::QDataStreamFailed when a blob does not fit a u32 length.
Sourcepub fn live_wrap_count(&self) -> usize
pub fn live_wrap_count(&self) -> usize
Number of wraps of the committed generation; 0 without a trailer.
Trait Implementations§
impl Eq for KeyData
impl StructuralPartialEq for KeyData
Auto Trait Implementations§
impl Freeze for KeyData
impl RefUnwindSafe for KeyData
impl Send for KeyData
impl Sync for KeyData
impl Unpin for KeyData
impl UnsafeUnpin for KeyData
impl UnwindSafe for KeyData
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more