pub trait LockInterface {
// Required methods
fn id(&self) -> &LockId;
fn decrypt_lock_key(
&self,
lockbox: &LockLockboxRef,
) -> Result<LockKey, CryptoError>;
fn decrypt_identity_key(
&self,
lockbox: &IdentityLockboxRef,
) -> Result<IdentityKey, CryptoError>;
fn decrypt_stream_key(
&self,
lockbox: &StreamLockboxRef,
) -> Result<StreamKey, CryptoError>;
fn decrypt_data(
&self,
lockbox: &DataLockboxRef,
) -> Result<Vec<u8>, CryptoError>;
fn self_export_lock(
&self,
csprng: &mut dyn CryptoSrc,
receive_lock: &LockId,
) -> Option<LockLockbox>;
fn self_export_stream(
&self,
csprng: &mut dyn CryptoSrc,
receive_stream: &StreamKey,
) -> Option<LockLockbox>;
}Expand description
A decryption interface, implemented by anything that can hold a private cryptographic decryption key.
An implementor must handle all supported Diffie-Hellman algorithms and symmetric-key encryption algorithms.
Required Methods§
Sourcefn decrypt_lock_key(
&self,
lockbox: &LockLockboxRef,
) -> Result<LockKey, CryptoError>
fn decrypt_lock_key( &self, lockbox: &LockLockboxRef, ) -> Result<LockKey, CryptoError>
Decrypt an exported LockKey.
Sourcefn decrypt_identity_key(
&self,
lockbox: &IdentityLockboxRef,
) -> Result<IdentityKey, CryptoError>
fn decrypt_identity_key( &self, lockbox: &IdentityLockboxRef, ) -> Result<IdentityKey, CryptoError>
Decrypt an exported IdentityKey.
Sourcefn decrypt_stream_key(
&self,
lockbox: &StreamLockboxRef,
) -> Result<StreamKey, CryptoError>
fn decrypt_stream_key( &self, lockbox: &StreamLockboxRef, ) -> Result<StreamKey, CryptoError>
Decrypt an exported StreamKey.
Sourcefn decrypt_data(&self, lockbox: &DataLockboxRef) -> Result<Vec<u8>, CryptoError>
fn decrypt_data(&self, lockbox: &DataLockboxRef) -> Result<Vec<u8>, CryptoError>
Decrypt encrypted data.
Sourcefn self_export_lock(
&self,
csprng: &mut dyn CryptoSrc,
receive_lock: &LockId,
) -> Option<LockLockbox>
fn self_export_lock( &self, csprng: &mut dyn CryptoSrc, receive_lock: &LockId, ) -> Option<LockLockbox>
Export the decryption key in a LockLockbox, with receive_lock as the recipient. If the
key cannot be exported, this should return None.
Sourcefn self_export_stream(
&self,
csprng: &mut dyn CryptoSrc,
receive_stream: &StreamKey,
) -> Option<LockLockbox>
fn self_export_stream( &self, csprng: &mut dyn CryptoSrc, receive_stream: &StreamKey, ) -> Option<LockLockbox>
Export the decryption key in a LockLockbox, with receive_stream as the recipient. If the
key cannot be exported, this should return None.