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§

source

fn id(&self) -> &LockId

Get the corresponding LockId for the private key.

source

fn decrypt_lock_key( &self, lockbox: &LockLockboxRef ) -> Result<LockKey, CryptoError>

Decrypt an exported LockKey.

source

fn decrypt_identity_key( &self, lockbox: &IdentityLockboxRef ) -> Result<IdentityKey, CryptoError>

Decrypt an exported IdentityKey.

source

fn decrypt_stream_key( &self, lockbox: &StreamLockboxRef ) -> Result<StreamKey, CryptoError>

Decrypt an exported StreamKey.

source

fn decrypt_data(&self, lockbox: &DataLockboxRef) -> Result<Vec<u8>, CryptoError>

Decrypt encrypted data.

source

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.

source

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.

Implementors§