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