pub struct LockLockbox(/* private fields */);
Expand description
An encrypted LockKey
.
This must be decrypted by the matching recipient, which will return the LockKey
on success.
It can either be decrypted on its own, returning a temporary LockKey
, or through a Vault,
which will store the LockKey
.
When decoding, a reference to the data is first created: LockLockboxRef
, which can then be
converted with to_owned
to create this struct.
See: StreamKey::decrypt_lock_key
,
LockKey::decrypt_lock_key
, and
Vault::decrypt_lock_key
.
§Example
Using a StreamKey
for decryption:
// We have `enc`, a byte vector containing a lockbox
let dec_lockbox: LockLockbox = LockLockboxRef::from_bytes(&enc[..])?.to_owned();
let recipient: LockboxRecipient = dec_lockbox.recipient();
// ...
// Retrieve the key by looking up recipient
// ...
let dec_key: LockKey = key.decrypt_lock_key(&dec_lockbox)?;
Methods from Deref<Target = LockLockboxRef>§
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<LockLockboxRef> for LockLockbox
impl Borrow<LockLockboxRef> for LockLockbox
Source§fn borrow(&self) -> &LockLockboxRef
fn borrow(&self) -> &LockLockboxRef
Immutably borrows from an owned value. Read more
Source§impl Clone for LockLockbox
impl Clone for LockLockbox
Source§fn clone(&self) -> LockLockbox
fn clone(&self) -> LockLockbox
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 LockLockbox
impl Debug for LockLockbox
Source§impl Deref for LockLockbox
impl Deref for LockLockbox
Source§impl<'de> Deserialize<'de> for LockLockbox
impl<'de> Deserialize<'de> for LockLockbox
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 LockLockbox
impl Hash for LockLockbox
Source§impl PartialEq for LockLockbox
impl PartialEq for LockLockbox
Source§impl Serialize for LockLockbox
impl Serialize for LockLockbox
impl Eq for LockLockbox
impl StructuralPartialEq for LockLockbox
Auto Trait Implementations§
impl Freeze for LockLockbox
impl RefUnwindSafe for LockLockbox
impl Send for LockLockbox
impl Sync for LockLockbox
impl Unpin for LockLockbox
impl UnwindSafe for LockLockbox
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