pub struct EncryptionRuntime { /* private fields */ }Expand description
Runtime encryption handle. Owns the master key and zeroizes it on drop.
Constructed once per Database::open via from_config. Cheap to clone
(the wrapped state lives behind Arc).
Implementations§
Source§impl EncryptionRuntime
impl EncryptionRuntime
Sourcepub fn from_config(config: EncryptionConfig, password: String) -> Result<Self>
pub fn from_config(config: EncryptionConfig, password: String) -> Result<Self>
Derive the master key and build a runtime.
password is consumed and zeroized before this function returns.
Errors if encryption is disabled in config, the password is empty,
or the config fails validation.
Sourcepub fn encrypt(&self, plaintext: &[u8]) -> Result<Vec<u8>>
pub fn encrypt(&self, plaintext: &[u8]) -> Result<Vec<u8>>
Encrypt plaintext, returning the serialized envelope.
pub fn algorithm(&self) -> &'static str
pub fn is_enabled(&self) -> bool
Trait Implementations§
Source§impl Clone for EncryptionRuntime
impl Clone for EncryptionRuntime
Source§fn clone(&self) -> EncryptionRuntime
fn clone(&self) -> EncryptionRuntime
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for EncryptionRuntime
impl RefUnwindSafe for EncryptionRuntime
impl Send for EncryptionRuntime
impl Sync for EncryptionRuntime
impl Unpin for EncryptionRuntime
impl UnsafeUnpin for EncryptionRuntime
impl UnwindSafe for EncryptionRuntime
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