Struct fog_crypto::lockbox::StreamLockboxRef[][src]

pub struct StreamLockboxRef(_);

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

impl StreamLockboxRef[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<StreamLockboxRef> for StreamLockbox[src]

impl Debug for StreamLockboxRef[src]

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

impl Eq for StreamLockboxRef[src]

impl Hash for StreamLockboxRef[src]

impl PartialEq<StreamLockboxRef> for StreamLockboxRef[src]

impl Serialize for StreamLockboxRef[src]

impl StructuralEq for StreamLockboxRef[src]

impl StructuralPartialEq for StreamLockboxRef[src]

impl ToOwned for StreamLockboxRef[src]

type Owned = StreamLockbox

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]