pub struct KeyManager { /* private fields */ }Expand description
Key management system for encryption keys
Implementations§
Source§impl KeyManager
impl KeyManager
Sourcepub fn add_key(&mut self, key: EncryptionKey) -> Result<()>
pub fn add_key(&mut self, key: EncryptionKey) -> Result<()>
Add a key to the manager
Sourcepub fn generate_key(id: String) -> Result<EncryptionKey>
pub fn generate_key(id: String) -> Result<EncryptionKey>
Generate a new AES-256 key
Sourcepub fn derive_key_from_password(
id: String,
password: &str,
salt: &[u8],
) -> Result<EncryptionKey>
pub fn derive_key_from_password( id: String, password: &str, salt: &[u8], ) -> Result<EncryptionKey>
Generate a key from a password using PBKDF2
Sourcepub fn get_key(&self, key_id: &str) -> Result<&EncryptionKey>
pub fn get_key(&self, key_id: &str) -> Result<&EncryptionKey>
Get a key by ID
Sourcepub fn set_default_key(&mut self, key_id: &str) -> Result<()>
pub fn set_default_key(&mut self, key_id: &str) -> Result<()>
Set the default key
Trait Implementations§
Source§impl Clone for KeyManager
impl Clone for KeyManager
Source§fn clone(&self) -> KeyManager
fn clone(&self) -> KeyManager
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for KeyManager
impl Debug for KeyManager
Auto Trait Implementations§
impl Freeze for KeyManager
impl RefUnwindSafe for KeyManager
impl Send for KeyManager
impl Sync for KeyManager
impl Unpin for KeyManager
impl UnwindSafe for KeyManager
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more