Struct fog_crypto::lockbox::StreamLockboxRef
source · pub struct StreamLockboxRef(_);
Expand description
An encrypted StreamKey
.
This must be decrypted by the matching recipient, which will return the StreamKey
on
success. It can either be decrypted on its own, returning a temporary StreamKey
, or
through a Vault, which will store the StreamKey
.
This is only a reference to an encrypted payload. The owned version is StreamLockbox
.
See: StreamKey::decrypt_stream_key
,
LockKey::decrypt_stream_key
, and
Vault::decrypt_stream_key
.
Example
Using a StreamKey
for decryption (different from the one contained in the lockbox!):
// We have `enc`, a byte vector containing a lockbox
let dec_lockbox: &StreamLockboxRef = StreamLockboxRef::from_bytes(&enc[..])?;
let recipient: LockboxRecipient = dec_lockbox.recipient();
// ...
// Retrieve the key by looking up recipient
// ...
let dec_key: StreamKey = key.decrypt_stream_key(&dec_lockbox)?;
Implementations§
source§impl StreamLockboxRef
impl StreamLockboxRef
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<&Self, CryptoError>
Trait Implementations§
source§impl Borrow<StreamLockboxRef> for StreamLockbox
impl Borrow<StreamLockboxRef> for StreamLockbox
source§fn borrow(&self) -> &StreamLockboxRef
fn borrow(&self) -> &StreamLockboxRef
Immutably borrows from an owned value. Read more
source§impl Debug for StreamLockboxRef
impl Debug for StreamLockboxRef
source§impl<'de: 'a, 'a> Deserialize<'de> for &'a StreamLockboxRef
impl<'de: 'a, 'a> Deserialize<'de> for &'a StreamLockboxRef
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 StreamLockboxRef
impl Hash for StreamLockboxRef
source§impl PartialEq<StreamLockboxRef> for StreamLockboxRef
impl PartialEq<StreamLockboxRef> for StreamLockboxRef
source§fn eq(&self, other: &StreamLockboxRef) -> bool
fn eq(&self, other: &StreamLockboxRef) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for StreamLockboxRef
impl Serialize for StreamLockboxRef
source§impl ToOwned for StreamLockboxRef
impl ToOwned for StreamLockboxRef
§type Owned = StreamLockbox
type Owned = StreamLockbox
The resulting type after obtaining ownership.
source§fn to_owned(&self) -> Self::Owned
fn to_owned(&self) -> Self::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