Struct fog_crypto::lockbox::LockLockboxRef[][src]

pub struct LockLockboxRef(_);

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

impl LockLockboxRef[src]

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

Decompose the lockbox into its component parts.

pub fn version(&self) -> u8[src]

Get the stream encryption version.

pub fn recipient(&self) -> LockboxRecipient[src]

Get the target recipient who can decrypt this.

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

The raw bytestream, suitable for serialization.

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

Trait Implementations

impl Borrow<LockLockboxRef> for LockLockbox[src]

impl Debug for LockLockboxRef[src]

impl<'de: 'a, 'a> Deserialize<'de> for &'a LockLockboxRef[src]

impl Eq for LockLockboxRef[src]

impl Hash for LockLockboxRef[src]

impl PartialEq<LockLockboxRef> for LockLockboxRef[src]

impl Serialize for LockLockboxRef[src]

impl StructuralEq for LockLockboxRef[src]

impl StructuralPartialEq for LockLockboxRef[src]

impl ToOwned for LockLockboxRef[src]

type Owned = LockLockbox

The resulting type after obtaining ownership.

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]