Skip to content

Commit 3c62a9f

Browse files
committed
Zeroize KeyObfuscator keys on Drop
.. to make sure the values don't linger in memory.
1 parent 6873274 commit 3c62a9f

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/util/key_obfuscator.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,14 @@ impl KeyObfuscator {
151151
}
152152
}
153153

154+
impl Drop for KeyObfuscator {
155+
fn drop(&mut self) {
156+
// Zeroize the owned keys
157+
self.obfuscation_key.copy_from_slice(&[0u8]);
158+
self.hashing_key.copy_from_slice(&[0u8]);
159+
}
160+
}
161+
154162
#[cfg(test)]
155163
mod tests {
156164
use crate::util::key_obfuscator::KeyObfuscator;

0 commit comments

Comments
 (0)