Struct StreamLockboxRef

Source
pub struct StreamLockboxRef(/* private fields */);
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

Source

pub fn as_parts(&self) -> LockboxParts<'_>

Decompose the lockbox into its component parts.

Source

pub fn version(&self) -> u8

Get the stream encryption version.

Source

pub fn recipient(&self) -> LockboxRecipient

Get the target recipient who can decrypt this.

Source

pub fn as_bytes(&self) -> &[u8]

The raw bytestream, suitable for serialization.

Source

pub fn from_bytes(buf: &[u8]) -> Result<&Self, CryptoError>

Trait Implementations§

Source§

impl Borrow<StreamLockboxRef> for StreamLockbox

Source§

fn borrow(&self) -> &StreamLockboxRef

Immutably borrows from an owned value. Read more
Source§

impl Debug for StreamLockboxRef

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de: 'a, 'a> Deserialize<'de> for &'a StreamLockboxRef

Source§

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

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
Source§

impl PartialEq for StreamLockboxRef

Source§

fn eq(&self, other: &StreamLockboxRef) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Serialize for StreamLockboxRef

Source§

fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
where S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl ToOwned for StreamLockboxRef

Source§

type Owned = StreamLockbox

The resulting type after obtaining ownership.
Source§

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)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl Eq for StreamLockboxRef

Source§

impl StructuralPartialEq for StreamLockboxRef

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more