(&self)
| 195 | } |
| 196 | |
| 197 | async fn rotate(&self) -> Result<Zeroizing<[u8; 32]>> { |
| 198 | let old_ciphertext = self.read_ciphertext_blob()?; |
| 199 | |
| 200 | // Rewrap with Vault (no plaintext leaves Vault during rewrap). |
| 201 | let new_ciphertext = self.rewrap_with_vault(&old_ciphertext).await?; |
| 202 | self.write_ciphertext_blob(&new_ciphertext)?; |
| 203 | |
| 204 | // Decrypt the new ciphertext to get the new plaintext key. |
| 205 | let key = self.decrypt_with_vault(&new_ciphertext).await?; |
| 206 | info!( |
| 207 | mount = %self.mount, |
| 208 | key_name = %self.key_name, |
| 209 | "Vault transit key rotated successfully" |
| 210 | ); |
| 211 | Ok(key) |
| 212 | } |
| 213 | } |
| 214 | |
| 215 | fn decode_32_byte_b64(b64: &str) -> Result<Zeroizing<[u8; 32]>> { |
no test coverage detected