Struct fog_crypto::lockbox::IdentityLockboxRef
source · pub struct IdentityLockboxRef(_);
Expand description
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§
source§impl IdentityLockboxRef
impl IdentityLockboxRef
sourcepub fn as_parts(&self) -> LockboxParts<'_>
pub fn as_parts(&self) -> LockboxParts<'_>
Decompose the lockbox into its component parts.
sourcepub fn recipient(&self) -> LockboxRecipient
pub fn recipient(&self) -> LockboxRecipient
Get the target recipient who can decrypt this.
pub fn from_bytes(buf: &[u8]) -> Result<&Self, CryptoError>
Trait Implementations§
source§impl Borrow<IdentityLockboxRef> for IdentityLockbox
impl Borrow<IdentityLockboxRef> for IdentityLockbox
source§fn borrow(&self) -> &IdentityLockboxRef
fn borrow(&self) -> &IdentityLockboxRef
Immutably borrows from an owned value. Read more
source§impl Debug for IdentityLockboxRef
impl Debug for IdentityLockboxRef
source§impl<'de: 'a, 'a> Deserialize<'de> for &'a IdentityLockboxRef
impl<'de: 'a, 'a> Deserialize<'de> for &'a IdentityLockboxRef
source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Hash for IdentityLockboxRef
impl Hash for IdentityLockboxRef
source§impl PartialEq<IdentityLockboxRef> for IdentityLockboxRef
impl PartialEq<IdentityLockboxRef> for IdentityLockboxRef
source§fn eq(&self, other: &IdentityLockboxRef) -> bool
fn eq(&self, other: &IdentityLockboxRef) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl Serialize for IdentityLockboxRef
impl Serialize for IdentityLockboxRef
source§impl ToOwned for IdentityLockboxRef
impl ToOwned for IdentityLockboxRef
§type Owned = IdentityLockbox
type Owned = IdentityLockbox
The resulting type after obtaining ownership.
source§fn to_owned(&self) -> Self::Owned
fn to_owned(&self) -> Self::Owned
Creates owned data from borrowed data, usually by cloning. Read more
1.63.0 · source§fn clone_into(&self, target: &mut Self::Owned)
fn clone_into(&self, target: &mut Self::Owned)
Uses borrowed data to replace owned data, usually by cloning. Read more