Struct fog_crypto::lockbox::StreamLockbox
source · pub struct StreamLockbox(_);
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
.
When decoding, a reference to the data is first created: StreamLockboxRef
, which can then
be converted with to_owned
to create this struct.
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: StreamLockbox = StreamLockboxRef::from_bytes(&enc[..])?.to_owned();
let recipient: LockboxRecipient = dec_lockbox.recipient();
// ...
// Retrieve the key by looking up recipient
// ...
let dec_key: StreamKey = key.decrypt_stream_key(&dec_lockbox)?;
Methods from Deref<Target = 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.
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 Clone for StreamLockbox
impl Clone for StreamLockbox
source§fn clone(&self) -> StreamLockbox
fn clone(&self) -> StreamLockbox
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 StreamLockbox
impl Debug for StreamLockbox
source§impl Deref for StreamLockbox
impl Deref for StreamLockbox
source§impl<'de> Deserialize<'de> for StreamLockbox
impl<'de> Deserialize<'de> for StreamLockbox
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 StreamLockbox
impl Hash for StreamLockbox
source§impl PartialEq<StreamLockbox> for StreamLockbox
impl PartialEq<StreamLockbox> for StreamLockbox
source§fn eq(&self, other: &StreamLockbox) -> bool
fn eq(&self, other: &StreamLockbox) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for StreamLockbox
impl Serialize for StreamLockbox
impl Eq for StreamLockbox
impl StructuralEq for StreamLockbox
impl StructuralPartialEq for StreamLockbox
Auto Trait Implementations§
impl RefUnwindSafe for StreamLockbox
impl Send for StreamLockbox
impl Sync for StreamLockbox
impl Unpin for StreamLockbox
impl UnwindSafe for StreamLockbox
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