Struct fog_crypto::lock::BareLockKey
source · pub struct BareLockKey { /* 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 BareLockKey
impl BareLockKey
sourcepub fn with_rng<R>(csprng: &mut R) -> Selfwhere
R: CryptoRng + RngCore,
pub fn with_rng<R>(csprng: &mut R) -> Selfwhere R: CryptoRng + RngCore,
Generate a new key given a cryptographic random number generator.
sourcepub fn with_rng_and_version<R>(
csprng: &mut R,
version: u8
) -> Result<Self, CryptoError>where
R: CryptoRng + RngCore,
pub fn with_rng_and_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 Default for BareLockKey
impl Default for BareLockKey
source§impl LockInterface for BareLockKey
impl LockInterface for BareLockKey
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.Auto Trait Implementations§
impl RefUnwindSafe for BareLockKey
impl Send for BareLockKey
impl Sync for BareLockKey
impl Unpin for BareLockKey
impl UnwindSafe for BareLockKey
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more