Trait fog_crypto::stream::StreamInterface [−][src]
A symmetric encryption/decryption interface, implemented by anything that can hold a symmetric encryption key.
An implementor must handle all supported symmetric-key encryption algorithms.
Required methods
fn id(&self) -> &StreamId[src]
Get the corresponding StreamId for the symmetric key.
fn encrypt(
&self,
csprng: &mut dyn CryptoSrc,
lock_type: LockboxType,
content: &[u8]
) -> Vec<u8>[src]
&self,
csprng: &mut dyn CryptoSrc,
lock_type: LockboxType,
content: &[u8]
) -> Vec<u8>
Encrypt raw data into a lockbox, following the StreamKey-recipient lockbox format (see
lockbox.
fn decrypt_lock_key(
&self,
lockbox: &LockLockboxRef
) -> Result<LockKey, CryptoError>[src]
&self,
lockbox: &LockLockboxRef
) -> Result<LockKey, CryptoError>
Decrypt a LockLockboxRef and return a temporary (not stored in Vault) LockKey on success.
fn decrypt_identity_key(
&self,
lockbox: &IdentityLockboxRef
) -> Result<IdentityKey, CryptoError>[src]
&self,
lockbox: &IdentityLockboxRef
) -> Result<IdentityKey, CryptoError>
Decrypt a IdentityLockboxRef and return a temporary (not stored in Vault) IdentityKey on
success.
fn decrypt_stream_key(
&self,
lockbox: &StreamLockboxRef
) -> Result<StreamKey, CryptoError>[src]
&self,
lockbox: &StreamLockboxRef
) -> Result<StreamKey, CryptoError>
Decrypt a StreamLockboxRef and return a temporary (not stored in Vault) StreamKey on
success.
fn decrypt_data(&self, lockbox: &DataLockboxRef) -> Result<Vec<u8>, CryptoError>[src]
Decrypt a DataLockboxRef and return a the decoded raw data on success.
fn self_export_lock(
&self,
csprng: &mut dyn CryptoSrc,
receive_lock: &LockId
) -> Option<StreamLockbox>[src]
&self,
csprng: &mut dyn CryptoSrc,
receive_lock: &LockId
) -> Option<StreamLockbox>
Export the symmetric key in a StreamLockbox, with receive_lock as the recipient. If the
key cannot be exported, this should return None.
fn self_export_stream(
&self,
csprng: &mut dyn CryptoSrc,
receive_stream: &StreamKey
) -> Option<StreamLockbox>[src]
&self,
csprng: &mut dyn CryptoSrc,
receive_stream: &StreamKey
) -> Option<StreamLockbox>
Export the symmetric key in a StreamLockbox, with receive_stream as the recipient. If
the key cannot be exported, this should return None. Additionally, if the underlying
implementation does not allow moving the raw key into memory (i.e. it cannot call
StreamInterface::encrypt or
lock_id_encrypt) then None can also be
returned.
Implementors
impl StreamInterface for ContainedStreamKey[src]
fn id(&self) -> &StreamId[src]
fn encrypt(
&self,
csprng: &mut dyn CryptoSrc,
lock_type: LockboxType,
content: &[u8]
) -> Vec<u8>[src]
&self,
csprng: &mut dyn CryptoSrc,
lock_type: LockboxType,
content: &[u8]
) -> Vec<u8>
fn decrypt_lock_key(
&self,
lockbox: &LockLockboxRef
) -> Result<LockKey, CryptoError>[src]
&self,
lockbox: &LockLockboxRef
) -> Result<LockKey, CryptoError>
fn decrypt_identity_key(
&self,
lockbox: &IdentityLockboxRef
) -> Result<IdentityKey, CryptoError>[src]
&self,
lockbox: &IdentityLockboxRef
) -> Result<IdentityKey, CryptoError>
fn decrypt_stream_key(
&self,
lockbox: &StreamLockboxRef
) -> Result<StreamKey, CryptoError>[src]
&self,
lockbox: &StreamLockboxRef
) -> Result<StreamKey, CryptoError>
fn decrypt_data(&self, lockbox: &DataLockboxRef) -> Result<Vec<u8>, CryptoError>[src]
fn self_export_lock(
&self,
csprng: &mut dyn CryptoSrc,
receive_lock: &LockId
) -> Option<StreamLockbox>[src]
&self,
csprng: &mut dyn CryptoSrc,
receive_lock: &LockId
) -> Option<StreamLockbox>
fn self_export_stream(
&self,
csprng: &mut dyn CryptoSrc,
receive_stream: &StreamKey
) -> Option<StreamLockbox>[src]
&self,
csprng: &mut dyn CryptoSrc,
receive_stream: &StreamKey
) -> Option<StreamLockbox>