pub struct EncryptedData {
pub data: String,
pub nonce: String,
pub algorithm: String,
pub key_id: String,
pub v: u8,
pub key_derivation: String,
}Expand description
Encrypted data container with metadata.
key_id makes this a versioned envelope: a value encrypted under one key
can still be decrypted after the current key rotates, as long as the
old key is still loadable (see KeyProvider). Writers always use the
current key; readers look up whichever key the envelope names.
v and key_derivation exist for backward compatibility with the
original, pre-this-redesign public EncryptedStorage (format version
0): that format had no key_id and no AAD binding at encryption time.
An envelope with v == 0 (including any envelope missing the v field
entirely, since #[serde(default)] fills it with 0) is decrypted
against every loaded key with an empty AAD, matching the old behavior;
see StorageEncryption::decrypt.
Fields§
§data: StringBase64 encoded encrypted data
nonce: StringBase64 encoded nonce/IV (96 bits, randomly generated per encryption)
algorithm: StringAlgorithm identifier
key_id: StringWhich key (by id) encrypted this value. Empty for format version 0
(the original EncryptedStorage, which had no key-id concept).
v: u8Envelope format version. 0 (including an absent field, which
deserializes to 0) is the original pre-redesign format; 1 is
the legacy versioned-key_id format; 2 is the current format
(metadata bound into the AAD).
key_derivation: StringPresent only for format-version-0 compatibility (the original
field name was key_derivation); current envelopes don’t set it.
Trait Implementations§
Source§impl Clone for EncryptedData
impl Clone for EncryptedData
Source§impl Debug for EncryptedData
impl Debug for EncryptedData
Source§impl<'de> Deserialize<'de> for EncryptedData
impl<'de> Deserialize<'de> for EncryptedData
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>,
Auto Trait Implementations§
impl Freeze for EncryptedData
impl RefUnwindSafe for EncryptedData
impl Send for EncryptedData
impl Sync for EncryptedData
impl Unpin for EncryptedData
impl UnsafeUnpin for EncryptedData
impl UnwindSafe for EncryptedData
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
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> ⓘ
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