pub trait Rotation {
// Required method
fn rotate(&mut self) -> Result<(), BwError>;
}
Expand description
The Rotation
trait encapsulates the best practice of rotating
cryptographic or sensitive materials, minimizing the potential
impact of key compromise or algorithmic predictions.
Secure systems often implement rotation to limit the utility of compromised keys and to periodically refresh cryptographic materials, ensuring persistent protection against evolving threats.
§Example
let key = EdDsaKey::generate().expect("Key generation failed");
let mut expiring_key = AutoExpiring::new(Duration::seconds(10), key).unwrap();
expiring_key.rotate().expect("Key generation failed");
§Good Practices
Implement the Rotation
trait for entities in your application
where periodical change or refreshment is vital for sustaining
security, especially for cryptographic keys, tokens, or salts.