Struct fog_pack::types::DataLockboxRef[][src]

pub struct DataLockboxRef(_);

General encrypted data.

This must be decrypted by the matching recipient, which will return a Vec<u8> on success. It can either be decrypted on its own or through a Vault. In both cases, the data is returned without being stored anywhere.

This is only a reference to an encrypted payload. The owned version is DataLockbox.

See: StreamKey::decrypt_data, LockKey::decrypt_data, and Vault::decrypt_data.

Example

Using a StreamKey for decryption:

// We have `enc`, a byte vector containing a lockbox
let dec_lockbox: &DataLockboxRef = DataLockboxRef::from_bytes(&enc[..])?;
let recipient: LockboxRecipient = dec_lockbox.recipient();
// ...
// Retrieve the key by looking up recipient
// ...
let plaintext: Vec<u8> = key.decrypt_data(&dec_lockbox)?;

Implementations

impl DataLockboxRef[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<&DataLockboxRef, CryptoError>[src]

Trait Implementations

impl Borrow<DataLockboxRef> for DataLockbox[src]

impl Debug for DataLockboxRef[src]

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

impl Eq for DataLockboxRef[src]

impl<'a> From<&'a DataLockboxRef> for ValueRef<'a>[src]

impl Hash for DataLockboxRef[src]

impl PartialEq<DataLockboxRef> for DataLockboxRef[src]

impl Serialize for DataLockboxRef[src]

impl StructuralEq for DataLockboxRef[src]

impl StructuralPartialEq for DataLockboxRef[src]

impl ToOwned for DataLockboxRef[src]

type Owned = DataLockbox

The resulting type after obtaining ownership.

impl<'a> TryFrom<ValueRef<'a>> for &'a DataLockboxRef[src]

type Error = ValueRef<'a>

The type returned in the event of a conversion error.

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]