Struct fog_pack::types::DataLockbox[][src]

pub struct DataLockbox(_);

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.

When decoding, a reference to the data is first created: DataLockboxRef, which can then be converted with to_owned to create this struct.

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: DataLockbox = DataLockboxRef::from_bytes(&enc[..])?.to_owned();
let recipient: LockboxRecipient = dec_lockbox.recipient();
// ...
// Retrieve the key by looking up recipient
// ...
let plaintext: Vec<u8> = key.decrypt_data(&dec_lockbox)?;

Methods from Deref<Target = DataLockboxRef>

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.

Trait Implementations

impl Borrow<DataLockboxRef> for DataLockbox[src]

impl Clone for DataLockbox[src]

impl Debug for DataLockbox[src]

impl Deref for DataLockbox[src]

type Target = DataLockboxRef

The resulting type after dereferencing.

impl<'de> Deserialize<'de> for DataLockbox[src]

impl Eq for DataLockbox[src]

impl From<DataLockbox> for Value[src]

impl Hash for DataLockbox[src]

impl PartialEq<DataLockbox> for DataLockbox[src]

impl Serialize for DataLockbox[src]

impl StructuralEq for DataLockbox[src]

impl StructuralPartialEq for DataLockbox[src]

impl TryFrom<Value> for DataLockbox[src]

type Error = Value

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]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,