Struct fog_crypto::lockbox::DataLockbox
source · pub struct DataLockbox(_);
Expand description
General encrypted data.
This must be decrypted by the matching recipient, which will return a Vec<u8>
on success.
It can either be decrypted on its own or through a Vault. In both cases, the data is returned
without being stored anywhere.
When decoding, a reference to the data is first created: DataLockboxRef
, which can then be
converted with to_owned
to create this struct.
See: StreamKey::decrypt_data
,
LockKey::decrypt_data
, and
Vault::decrypt_data
.
Example
Using a StreamKey
for decryption:
// We have `enc`, a byte vector containing a lockbox
let dec_lockbox: DataLockbox = DataLockboxRef::from_bytes(&enc[..])?.to_owned();
let recipient: LockboxRecipient = dec_lockbox.recipient();
// ...
// Retrieve the key by looking up recipient
// ...
let plaintext: Vec<u8> = key.decrypt_data(&dec_lockbox)?;
Methods from Deref<Target = DataLockboxRef>§
sourcepub fn as_parts(&self) -> LockboxParts<'_>
pub fn as_parts(&self) -> LockboxParts<'_>
Decompose the lockbox into its component parts.
sourcepub fn recipient(&self) -> LockboxRecipient
pub fn recipient(&self) -> LockboxRecipient
Get the target recipient who can decrypt this.
Trait Implementations§
source§impl Borrow<DataLockboxRef> for DataLockbox
impl Borrow<DataLockboxRef> for DataLockbox
source§fn borrow(&self) -> &DataLockboxRef
fn borrow(&self) -> &DataLockboxRef
Immutably borrows from an owned value. Read more
source§impl Clone for DataLockbox
impl Clone for DataLockbox
source§fn clone(&self) -> DataLockbox
fn clone(&self) -> DataLockbox
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for DataLockbox
impl Debug for DataLockbox
source§impl Deref for DataLockbox
impl Deref for DataLockbox
source§impl<'de> Deserialize<'de> for DataLockbox
impl<'de> Deserialize<'de> for DataLockbox
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>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Hash for DataLockbox
impl Hash for DataLockbox
source§impl PartialEq<DataLockbox> for DataLockbox
impl PartialEq<DataLockbox> for DataLockbox
source§fn eq(&self, other: &DataLockbox) -> bool
fn eq(&self, other: &DataLockbox) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for DataLockbox
impl Serialize for DataLockbox
impl Eq for DataLockbox
impl StructuralEq for DataLockbox
impl StructuralPartialEq for DataLockbox
Auto Trait Implementations§
impl RefUnwindSafe for DataLockbox
impl Send for DataLockbox
impl Sync for DataLockbox
impl Unpin for DataLockbox
impl UnwindSafe for DataLockbox
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