Struct fog_pack::types::IdentityLockboxRef [−][src]
An encrypted IdentityKey.
This must be decrypted by the matching recipient, which will return the IdentityKey on
success. It can either be decrypted on its own, returning a temporary IdentityKey, or
through a Vault, which will store the IdentityKey.
This is only a reference to an encrypted payload. The owned version is IdentityLockbox.
See: StreamKey::decrypt_identity_key,
LockKey::decrypt_identity_key, and
Vault::decrypt_identity_key.
Example
Using a StreamKey for decryption:
// We have `enc`, a byte vector containing a lockbox let dec_lockbox: &IdentityLockboxRef = IdentityLockboxRef::from_bytes(&enc[..])?; let recipient: LockboxRecipient = dec_lockbox.recipient(); // ... // Retrieve the key by looking up recipient // ... let dec_key: IdentityKey = key.decrypt_identity_key(&dec_lockbox)?;
Implementations
impl IdentityLockboxRef[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<&IdentityLockboxRef, CryptoError>[src]
Trait Implementations
impl Borrow<IdentityLockboxRef> for IdentityLockbox[src]
pub fn borrow(&self) -> &IdentityLockboxRef[src]
impl Debug for IdentityLockboxRef[src]
impl<'de, 'a> Deserialize<'de> for &'a IdentityLockboxRef where
'de: 'a, [src]
'de: 'a,
pub fn deserialize<D>(
deserializer: D
) -> Result<&'a IdentityLockboxRef, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>, [src]
deserializer: D
) -> Result<&'a IdentityLockboxRef, <D as Deserializer<'de>>::Error> where
D: Deserializer<'de>,
impl Eq for IdentityLockboxRef[src]
impl<'a> From<&'a IdentityLockboxRef> for ValueRef<'a>[src]
fn from(v: &'a IdentityLockboxRef) -> Self[src]
impl Hash for IdentityLockboxRef[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<IdentityLockboxRef> for IdentityLockboxRef[src]
pub fn eq(&self, other: &IdentityLockboxRef) -> bool[src]
pub fn ne(&self, other: &IdentityLockboxRef) -> bool[src]
impl Serialize for IdentityLockboxRef[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 IdentityLockboxRef[src]
impl StructuralPartialEq for IdentityLockboxRef[src]
impl ToOwned for IdentityLockboxRef[src]
type Owned = IdentityLockbox
The resulting type after obtaining ownership.