pub struct KeyManager { /* private fields */ }Expand description
Key manager for storing and rotating encryption keys.
Implementations§
Source§impl KeyManager
impl KeyManager
Sourcepub fn generate_key(
&self,
algorithm: EncryptionAlgorithm,
rotation_period_days: Option<u32>,
) -> Result<String>
pub fn generate_key( &self, algorithm: EncryptionAlgorithm, rotation_period_days: Option<u32>, ) -> Result<String>
Generate a new key.
Sourcepub fn add_key(
&self,
key_id: String,
key: Vec<u8>,
algorithm: EncryptionAlgorithm,
rotation_period_days: Option<u32>,
) -> Result<()>
pub fn add_key( &self, key_id: String, key: Vec<u8>, algorithm: EncryptionAlgorithm, rotation_period_days: Option<u32>, ) -> Result<()>
Add an existing key.
Sourcepub fn get_current_key(&self) -> Result<(String, Vec<u8>, KeyMetadata)>
pub fn get_current_key(&self) -> Result<(String, Vec<u8>, KeyMetadata)>
Get the current active key.
Sourcepub fn set_current_key(&self, key_id: String) -> Result<()>
pub fn set_current_key(&self, key_id: String) -> Result<()>
Set the current active key.
Sourcepub fn rotate_key(&self) -> Result<String>
pub fn rotate_key(&self) -> Result<String>
Rotate the current key.
Sourcepub fn list_keys(&self) -> Vec<(String, KeyMetadata)>
pub fn list_keys(&self) -> Vec<(String, KeyMetadata)>
List all keys.
Sourcepub fn list_expired_keys(&self) -> Vec<(String, KeyMetadata)>
pub fn list_expired_keys(&self) -> Vec<(String, KeyMetadata)>
List expired keys.
Sourcepub fn list_keys_needing_rotation(&self) -> Vec<(String, KeyMetadata)>
pub fn list_keys_needing_rotation(&self) -> Vec<(String, KeyMetadata)>
List keys that need rotation.
Sourcepub fn delete_key(&self, key_id: &str) -> Result<()>
pub fn delete_key(&self, key_id: &str) -> Result<()>
Delete a key.
Sourcepub fn create_encryptor(&self, key_id: &str) -> Result<AtRestEncryptor>
pub fn create_encryptor(&self, key_id: &str) -> Result<AtRestEncryptor>
Create an encryptor for a specific key.
Sourcepub fn create_current_encryptor(&self) -> Result<AtRestEncryptor>
pub fn create_current_encryptor(&self) -> Result<AtRestEncryptor>
Create an encryptor for the current key.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for KeyManager
impl !RefUnwindSafe for KeyManager
impl Send for KeyManager
impl Sync for KeyManager
impl Unpin for KeyManager
impl UnsafeUnpin 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> 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