pub struct DataLockbox(/* private fields */);
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 duplicate 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§type Target = DataLockboxRef
type Target = DataLockboxRef
The resulting type after dereferencing.
Source§impl<'de> Deserialize<'de> for DataLockbox
impl<'de> Deserialize<'de> for DataLockbox
Source§fn deserialize<D>(
deserializer: D,
) -> Result<DataLockbox, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<DataLockbox, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<DataLockbox> for Value
impl From<DataLockbox> for Value
Source§fn from(v: DataLockbox) -> Self
fn from(v: DataLockbox) -> Self
Converts to this type from the input type.
Source§impl Hash for DataLockbox
impl Hash for DataLockbox
Source§impl PartialEq for DataLockbox
impl PartialEq for DataLockbox
Source§impl Serialize for DataLockbox
impl Serialize for DataLockbox
Source§fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
fn serialize<S>(
&self,
serializer: S,
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error>where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
Source§impl TryFrom<Value> for DataLockbox
impl TryFrom<Value> for DataLockbox
impl Eq for DataLockbox
impl StructuralPartialEq for DataLockbox
Auto Trait Implementations§
impl Freeze for DataLockbox
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