pub struct DataEnvelope {
envelope_data: CoseEncrypt0Bytes,
}Expand description
DataEnvelope allows sealing structs entire structs to encrypted blobs.
Sealing a struct results in an encrypted blob, and a content-encryption-key. The content-encryption-key must be provided again when unsealing the data. A content encryption key allows easy key-rotation of the encrypting-key, as now just the content-encryption-keys need to be re-uploaded, instead of all data.
The content-encryption-key cannot be re-used for encrypting other data.
Note: This is explicitly meant for structured data, not large binary blobs (files).
Fields§
§envelope_data: CoseEncrypt0BytesImplementations§
Source§impl DataEnvelope
impl DataEnvelope
Sourcepub fn seal<Ids: KeyIds, T>(
data: T,
ctx: &mut KeyStoreContext<'_, Ids>,
) -> Result<(Self, Ids::Symmetric), DataEnvelopeError>where
T: Serialize + SealableVersionedData,
pub fn seal<Ids: KeyIds, T>(
data: T,
ctx: &mut KeyStoreContext<'_, Ids>,
) -> Result<(Self, Ids::Symmetric), DataEnvelopeError>where
T: Serialize + SealableVersionedData,
Seals a struct into an encrypted blob, and stores the content-encryption-key in the provided context.
Sourcepub fn seal_with_wrapping_key<Ids: KeyIds, T>(
data: T,
wrapping_key: &Ids::Symmetric,
ctx: &mut KeyStoreContext<'_, Ids>,
) -> Result<(Self, EncString), DataEnvelopeError>where
T: Serialize + SealableVersionedData,
pub fn seal_with_wrapping_key<Ids: KeyIds, T>(
data: T,
wrapping_key: &Ids::Symmetric,
ctx: &mut KeyStoreContext<'_, Ids>,
) -> Result<(Self, EncString), DataEnvelopeError>where
T: Serialize + SealableVersionedData,
Seals a struct into an encrypted blob. The content encryption key is wrapped with the provided wrapping key
Sourcefn seal_ref<T>(
data: &T,
namespace: &DataEnvelopeNamespace,
) -> Result<(DataEnvelope, XChaCha20Poly1305Key), DataEnvelopeError>where
T: Serialize + SealableVersionedData,
fn seal_ref<T>(
data: &T,
namespace: &DataEnvelopeNamespace,
) -> Result<(DataEnvelope, XChaCha20Poly1305Key), DataEnvelopeError>where
T: Serialize + SealableVersionedData,
Seals a struct into an encrypted blob, and returns the encrypted blob and the content-encryption-key.
Sourcepub fn unseal<Ids: KeyIds, T>(
&self,
cek_keyslot: Ids::Symmetric,
ctx: &mut KeyStoreContext<'_, Ids>,
) -> Result<T, DataEnvelopeError>where
T: DeserializeOwned + SealableVersionedData,
pub fn unseal<Ids: KeyIds, T>(
&self,
cek_keyslot: Ids::Symmetric,
ctx: &mut KeyStoreContext<'_, Ids>,
) -> Result<T, DataEnvelopeError>where
T: DeserializeOwned + SealableVersionedData,
Unseals the data from the encrypted blob using a content-encryption-key stored in the context.
Sourcepub fn unseal_with_wrapping_key<Ids: KeyIds, T>(
&self,
wrapping_key: &Ids::Symmetric,
wrapped_cek: &EncString,
ctx: &mut KeyStoreContext<'_, Ids>,
) -> Result<T, DataEnvelopeError>where
T: DeserializeOwned + SealableVersionedData,
pub fn unseal_with_wrapping_key<Ids: KeyIds, T>(
&self,
wrapping_key: &Ids::Symmetric,
wrapped_cek: &EncString,
ctx: &mut KeyStoreContext<'_, Ids>,
) -> Result<T, DataEnvelopeError>where
T: DeserializeOwned + SealableVersionedData,
Unseals the data from the encrypted blob and wrapped content-encryption-key.
Sourcefn unseal_ref<T>(
&self,
namespace: &DataEnvelopeNamespace,
cek: &XChaCha20Poly1305Key,
) -> Result<T, DataEnvelopeError>where
T: DeserializeOwned + SealableVersionedData,
fn unseal_ref<T>(
&self,
namespace: &DataEnvelopeNamespace,
cek: &XChaCha20Poly1305Key,
) -> Result<T, DataEnvelopeError>where
T: DeserializeOwned + SealableVersionedData,
Unseals the data from the encrypted blob using the provided content-encryption-key.
Trait Implementations§
Source§impl Clone for DataEnvelope
impl Clone for DataEnvelope
Source§fn clone(&self) -> DataEnvelope
fn clone(&self) -> DataEnvelope
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<UT> ConvertError<UT> for DataEnvelope
impl<UT> ConvertError<UT> for DataEnvelope
fn try_convert_unexpected_callback_error( e: UnexpectedUniFFICallbackError, ) -> Result<Self>
Source§impl Debug for DataEnvelope
impl Debug for DataEnvelope
Source§impl<'de> Deserialize<'de> for DataEnvelope
impl<'de> Deserialize<'de> for DataEnvelope
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>,
Source§impl Display for DataEnvelope
impl Display for DataEnvelope
Source§impl<UT> FfiConverter<UT> for DataEnvelope
impl<UT> FfiConverter<UT> for DataEnvelope
Source§const TYPE_ID_META: MetadataBuffer
const TYPE_ID_META: MetadataBuffer
Source§type FfiType = <String as Lower<UniFfiTag>>::FfiType
type FfiType = <String as Lower<UniFfiTag>>::FfiType
Source§fn lower(obj: DataEnvelope) -> Self::FfiType
fn lower(obj: DataEnvelope) -> Self::FfiType
Source§fn try_lift(v: Self::FfiType) -> Result<DataEnvelope>
fn try_lift(v: Self::FfiType) -> Result<DataEnvelope>
Source§impl From<&DataEnvelope> for Vec<u8>
impl From<&DataEnvelope> for Vec<u8>
Source§fn from(val: &DataEnvelope) -> Self
fn from(val: &DataEnvelope) -> Self
Source§impl From<DataEnvelope> for String
impl From<DataEnvelope> for String
Source§fn from(val: DataEnvelope) -> Self
fn from(val: DataEnvelope) -> Self
Source§impl FromStr for DataEnvelope
impl FromStr for DataEnvelope
Source§impl FromWasmAbi for DataEnvelope
impl FromWasmAbi for DataEnvelope
Source§impl<UT> Lift<UT> for DataEnvelope
impl<UT> Lift<UT> for DataEnvelope
Source§impl<UT> LiftRef<UT> for DataEnvelope
impl<UT> LiftRef<UT> for DataEnvelope
type LiftType = DataEnvelope
Source§impl<UT> LiftReturn<UT> for DataEnvelope
impl<UT> LiftReturn<UT> for DataEnvelope
Source§type ReturnType = <DataEnvelope as Lift<UT>>::FfiType
type ReturnType = <DataEnvelope as Lift<UT>>::FfiType
Source§fn try_lift_successful_return(v: Self::ReturnType) -> Result<Self>
fn try_lift_successful_return(v: Self::ReturnType) -> Result<Self>
§fn lift_foreign_return(
ffi_return: Self::ReturnType,
call_status: RustCallStatus,
) -> Self
fn lift_foreign_return( ffi_return: Self::ReturnType, call_status: RustCallStatus, ) -> Self
§fn lift_error(_buf: RustBuffer) -> Self
fn lift_error(_buf: RustBuffer) -> Self
§fn handle_callback_unexpected_error(e: UnexpectedUniFFICallbackError) -> Self
fn handle_callback_unexpected_error(e: UnexpectedUniFFICallbackError) -> Self
Source§impl<UT> Lower<UT> for DataEnvelope
impl<UT> Lower<UT> for DataEnvelope
Source§impl<UT> LowerError<UT> for DataEnvelope
impl<UT> LowerError<UT> for DataEnvelope
Source§fn lower_error(obj: Self) -> RustBuffer
fn lower_error(obj: Self) -> RustBuffer
Source§impl<UT> LowerReturn<UT> for DataEnvelope
impl<UT> LowerReturn<UT> for DataEnvelope
Source§type ReturnType = <DataEnvelope as Lower<UT>>::FfiType
type ReturnType = <DataEnvelope as Lower<UT>>::FfiType
Source§fn lower_return(v: Self) -> Result<Self::ReturnType, RustCallError>
fn lower_return(v: Self) -> Result<Self::ReturnType, RustCallError>
§fn handle_failed_lift(
error: LiftArgsError,
) -> Result<Self::ReturnType, RustCallError>
fn handle_failed_lift( error: LiftArgsError, ) -> Result<Self::ReturnType, RustCallError>
Source§impl Serialize for DataEnvelope
impl Serialize for DataEnvelope
Source§impl<UT> TypeId<UT> for DataEnvelope
impl<UT> TypeId<UT> for DataEnvelope
const TYPE_ID_META: MetadataBuffer
Source§impl WasmDescribe for DataEnvelope
impl WasmDescribe for DataEnvelope
Auto Trait Implementations§
impl Freeze for DataEnvelope
impl RefUnwindSafe for DataEnvelope
impl Send for DataEnvelope
impl Sync for DataEnvelope
impl Unpin for DataEnvelope
impl UnwindSafe for DataEnvelope
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
§unsafe fn consume_handle(handle: Handle) -> Arc<T>
unsafe fn consume_handle(handle: Handle) -> Arc<T>
Arc<> Read moreSource§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