pub struct KeyRotationManager { /* private fields */ }Expand description
Key rotation manager.
Implementations§
Source§impl KeyRotationManager
impl KeyRotationManager
Sourcepub fn current_version(&self) -> u32
pub fn current_version(&self) -> u32
Get current key version.
Sourcepub fn rotate(
&mut self,
new_key: [u8; 32],
new_version: Option<u32>,
) -> Result<u32>
pub fn rotate( &mut self, new_key: [u8; 32], new_version: Option<u32>, ) -> Result<u32>
Rotate to new key.
Sourcepub fn encrypt(&self, plaintext: &[u8]) -> Result<Vec<u8>>
pub fn encrypt(&self, plaintext: &[u8]) -> Result<Vec<u8>>
Encrypt with current key.
Format: version(4) || nonce(16) || ciphertext || mac(16)
Sourcepub fn decrypt(&self, encrypted: &[u8]) -> Result<Vec<u8>>
pub fn decrypt(&self, encrypted: &[u8]) -> Result<Vec<u8>>
Decrypt with appropriate key version.
Sourcepub fn prune_old_keys(&mut self, keep_versions: usize) -> Vec<u32>
pub fn prune_old_keys(&mut self, keep_versions: usize) -> Vec<u32>
Prune old keys, keeping specified number of most recent.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for KeyRotationManager
impl RefUnwindSafe for KeyRotationManager
impl Send for KeyRotationManager
impl Sync for KeyRotationManager
impl Unpin for KeyRotationManager
impl UnsafeUnpin for KeyRotationManager
impl UnwindSafe for KeyRotationManager
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