pub struct LockLockboxRef(/* private fields */);
Expand description
An reference to 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
.
This is only a reference to an encrypted payload. The owned version is LockLockbox
.
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: &LockLockboxRef = LockLockboxRef::from_bytes(&enc[..])?;
let recipient: LockboxRecipient = dec_lockbox.recipient();
// ...
// Retrieve the key by looking up recipient
// ...
let dec_key: LockKey = key.decrypt_lock_key(&dec_lockbox)?;
Implementations§
Source§impl LockLockboxRef
impl 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.
pub fn from_bytes(buf: &[u8]) -> Result<&LockLockboxRef, CryptoError>
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 Debug for LockLockboxRef
impl Debug for LockLockboxRef
Source§impl<'de, 'a> Deserialize<'de> for &'a LockLockboxRefwhere
'de: 'a,
impl<'de, 'a> Deserialize<'de> for &'a LockLockboxRefwhere
'de: 'a,
Source§fn deserialize<D>(
deserializer: D,
) -> Result<&'a LockLockboxRef, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
fn deserialize<D>(
deserializer: D,
) -> Result<&'a LockLockboxRef, <D as Deserializer<'de>>::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<'a> From<&'a LockLockboxRef> for ValueRef<'a>
impl<'a> From<&'a LockLockboxRef> for ValueRef<'a>
Source§fn from(v: &'a LockLockboxRef) -> Self
fn from(v: &'a LockLockboxRef) -> Self
Converts to this type from the input type.
Source§impl Hash for LockLockboxRef
impl Hash for LockLockboxRef
Source§impl PartialEq for LockLockboxRef
impl PartialEq for LockLockboxRef
Source§impl Serialize for LockLockboxRef
impl Serialize for LockLockboxRef
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 ToOwned for LockLockboxRef
impl ToOwned for LockLockboxRef
Source§type Owned = LockLockbox
type Owned = LockLockbox
The resulting type after obtaining ownership.
Source§fn to_owned(&self) -> <LockLockboxRef as ToOwned>::Owned
fn to_owned(&self) -> <LockLockboxRef as ToOwned>::Owned
Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · Source§fn clone_into(&self, target: &mut Self::Owned)
fn clone_into(&self, target: &mut Self::Owned)
Uses borrowed data to replace owned data, usually by cloning. Read more