()
| 317 | |
| 318 | #[test] |
| 319 | fn dek_roundtrip() { |
| 320 | use std::os::unix::fs::PermissionsExt as _; |
| 321 | let dir = tempfile::tempdir().unwrap(); |
| 322 | let key_path = dir.path().join("master.key"); |
| 323 | let mut key_data = [0u8; 32]; |
| 324 | getrandom::fill(&mut key_data).unwrap(); |
| 325 | std::fs::write(&key_path, key_data).unwrap(); |
| 326 | std::fs::set_permissions(&key_path, std::fs::Permissions::from_mode(0o600)).unwrap(); |
| 327 | |
| 328 | let mut enc = VolumeEncryption::new(VolumeEncryptionConfig { |
| 329 | master_key_path: Some(key_path), |
| 330 | enabled: true, |
| 331 | algorithm: EncryptionAlgorithm::Aes256Gcm, |
| 332 | }); |
| 333 | enc.load_master_key().unwrap(); |
| 334 | assert!(enc.is_active()); |
| 335 | |
| 336 | let (dek, encrypted) = enc.generate_dek().unwrap(); |
| 337 | let decrypted = enc.decrypt_dek(&encrypted).unwrap(); |
| 338 | assert_eq!(dek, decrypted); |
| 339 | } |
| 340 | |
| 341 | #[test] |
| 342 | fn key_rotation() { |
nothing calls this directly
no test coverage detected