pub struct LockLockboxRef(_);
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

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<LockLockboxRef> for LockLockbox

source§

fn borrow(&self) -> &LockLockboxRef

Immutably borrows from an owned value. Read more
source§

impl Debug for LockLockboxRef

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 LockLockboxRef

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 LockLockboxRef

source§

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

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

impl PartialEq<LockLockboxRef> for LockLockboxRef

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for LockLockboxRef

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 LockLockboxRef

§

type Owned = LockLockbox

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 LockLockboxRef

source§

impl StructuralEq for LockLockboxRef

source§

impl StructuralPartialEq for LockLockboxRef

Auto Trait Implementations§

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more