Struct fog_pack::types::DataLockbox [−][src]
pub struct DataLockbox(_);Expand description
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>
Decompose the lockbox into its component parts.
Get the target recipient who can decrypt this.
Trait Implementations
Immutably borrows from an owned value. Read more
type Target = DataLockboxRef
type Target = DataLockboxRef
The resulting type after dereferencing.
Dereferences the value.
pub fn deserialize<D>(
deserializer: D
) -> Result<DataLockbox, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
pub fn deserialize<D>(
deserializer: D
) -> Result<DataLockbox, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Performs the conversion.
This method tests for self and other values to be equal, and is used
by ==. Read more
This method tests for !=.
pub fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
pub fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
Serialize this value into the given Serde serializer. Read more
Auto Trait Implementations
impl RefUnwindSafe for DataLockbox
impl Send for DataLockbox
impl Sync for DataLockbox
impl Unpin for DataLockbox
impl UnwindSafe for DataLockbox
Blanket Implementations
Mutably borrows from an owned value. Read more
type Output = T
type Output = T
Should always be Self