Struct fog_crypto::lock::ContainedLockKey
source · pub struct ContainedLockKey { /* private fields */ }Expand description
A self-contained implementor of LockInterface. It’s expected this will be used unless the
decryption key is being managed by the OS or a hardware module.
Implementations§
source§impl ContainedLockKey
impl ContainedLockKey
sourcepub fn generate<R>(csprng: &mut R) -> Selfwhere
R: CryptoRng + RngCore,
pub fn generate<R>(csprng: &mut R) -> Selfwhere R: CryptoRng + RngCore,
Generate a new key given a cryptographic random number generator.
sourcepub fn with_version<R>(csprng: &mut R, version: u8) -> Result<Self, CryptoError>where
R: CryptoRng + RngCore,
pub fn with_version<R>(csprng: &mut R, version: u8) -> Result<Self, CryptoError>where R: CryptoRng + RngCore,
Generate a new key with a specific version, given a cryptographic random number generator. Fails if the version isn’t supported.
sourcepub fn encode_vec(&self, buf: &mut Vec<u8>)
pub fn encode_vec(&self, buf: &mut Vec<u8>)
Encode directly to a byte vector. The resulting vector should be zeroized or overwritten before being dropped.
Trait Implementations§
source§impl LockInterface for ContainedLockKey
impl LockInterface for ContainedLockKey
source§fn decrypt_lock_key(
&self,
lockbox: &LockLockboxRef
) -> Result<LockKey, CryptoError>
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>
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>
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>
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>
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>
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.