pub struct KeyManagementStore { /* private fields */ }
Expand description
Key store for managing encryption keys
Implementations§
Source§impl KeyStore
impl KeyStore
Sourcepub fn with_storage(storage: Box<dyn KeyStorage + Send + Sync>) -> Self
pub fn with_storage(storage: Box<dyn KeyStorage + Send + Sync>) -> Self
Create a key store with custom storage backend
Sourcepub fn initialize_master_key(
&mut self,
master_password: &str,
) -> EncryptionResult<()>
pub fn initialize_master_key( &mut self, master_password: &str, ) -> EncryptionResult<()>
Initialize the master key for the key store
Sourcepub fn generate_key(
&mut self,
key_id: String,
algorithm: EncryptionAlgorithm,
purpose: String,
) -> EncryptionResult<()>
pub fn generate_key( &mut self, key_id: String, algorithm: EncryptionAlgorithm, purpose: String, ) -> EncryptionResult<()>
Generate a new encryption key
Sourcepub fn get_key(&self, key_id: &String) -> EncryptionResult<EncryptionKey>
pub fn get_key(&self, key_id: &String) -> EncryptionResult<EncryptionKey>
Retrieve and decrypt a key
Sourcepub fn record_key_usage(&mut self, key_id: &String) -> EncryptionResult<()>
pub fn record_key_usage(&mut self, key_id: &String) -> EncryptionResult<()>
Update key usage statistics
Sourcepub fn rotate_key(&mut self, key_id: &String) -> EncryptionResult<()>
pub fn rotate_key(&mut self, key_id: &String) -> EncryptionResult<()>
Rotate a key (generate new version)
Sourcepub fn delete_key(&mut self, key_id: &String) -> EncryptionResult<()>
pub fn delete_key(&mut self, key_id: &String) -> EncryptionResult<()>
Delete a key
Sourcepub fn get_key_metadata(&self, key_id: &String) -> Option<&KeyMetadata>
pub fn get_key_metadata(&self, key_id: &String) -> Option<&KeyMetadata>
Get key metadata
Sourcepub fn key_exists(&self, key_id: &String) -> bool
pub fn key_exists(&self, key_id: &String) -> bool
Check if a key exists and is active
Sourcepub fn set_key_expiration(
&mut self,
key_id: &String,
expires_at: DateTime<Utc>,
) -> EncryptionResult<()>
pub fn set_key_expiration( &mut self, key_id: &String, expires_at: DateTime<Utc>, ) -> EncryptionResult<()>
Set key expiration
Sourcepub fn cleanup_expired_keys(&mut self) -> EncryptionResult<Vec<String>>
pub fn cleanup_expired_keys(&mut self) -> EncryptionResult<Vec<String>>
Clean up expired keys
Sourcepub fn get_statistics(&self) -> KeyStoreStatistics
pub fn get_statistics(&self) -> KeyStoreStatistics
Get key statistics
Sourcepub fn export_metadata(&self) -> EncryptionResult<String>
pub fn export_metadata(&self) -> EncryptionResult<String>
Export key metadata for backup
Sourcepub fn import_metadata(&mut self, metadata_json: &str) -> EncryptionResult<()>
pub fn import_metadata(&mut self, metadata_json: &str) -> EncryptionResult<()>
Import key metadata
Trait Implementations§
Auto Trait Implementations§
impl Freeze for KeyStore
impl !RefUnwindSafe for KeyStore
impl Send for KeyStore
impl Sync for KeyStore
impl Unpin for KeyStore
impl !UnwindSafe for KeyStore
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