Struct fog_pack::types::DataLockboxRef [−][src]
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]
pub fn borrow(&self) -> &DataLockboxRef[src]
impl Debug for DataLockboxRef[src]
impl<'de, 'a> Deserialize<'de> for &'a DataLockboxRef where
'de: 'a, [src]
'de: 'a,
pub fn deserialize<D>(
deserializer: D
) -> Result<&'a DataLockboxRef, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>, [src]
deserializer: D
) -> Result<&'a DataLockboxRef, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
impl Eq for DataLockboxRef[src]
impl<'a> From<&'a DataLockboxRef> for ValueRef<'a>[src]
fn from(v: &'a DataLockboxRef) -> Self[src]
impl Hash for DataLockboxRef[src]
pub fn hash<__H>(&self, state: &mut __H) where
__H: Hasher, [src]
__H: Hasher,
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher, 1.3.0[src]
H: Hasher,
impl PartialEq<DataLockboxRef> for DataLockboxRef[src]
pub fn eq(&self, other: &DataLockboxRef) -> bool[src]
pub fn ne(&self, other: &DataLockboxRef) -> bool[src]
impl Serialize for DataLockboxRef[src]
pub fn serialize<S>(
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer, [src]
&self,
serializer: S
) -> Result<<S as Serializer>::Ok, <S as Serializer>::Error> where
S: Serializer,
impl StructuralEq for DataLockboxRef[src]
impl StructuralPartialEq for DataLockboxRef[src]
impl ToOwned for DataLockboxRef[src]
type Owned = DataLockbox
The resulting type after obtaining ownership.