From fad95a334ae6c32ccb522230021f97a03de9cebe Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Thu, 8 Apr 2021 10:37:49 +0200 Subject: [PATCH] tape: clear encryption key after backup (for security reasons) --- src/tape/drive/lto/sg_tape.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/tape/drive/lto/sg_tape.rs b/src/tape/drive/lto/sg_tape.rs index a451bbe2..8e822924 100644 --- a/src/tape/drive/lto/sg_tape.rs +++ b/src/tape/drive/lto/sg_tape.rs @@ -661,6 +661,14 @@ impl SgTape { } } +impl Drop for SgTape { + fn drop(&mut self) { + // For security reasons, clear the encryption key + let _ = self.set_encryption(None); + } +} + + pub struct SgTapeReader<'a> { sg_tape: &'a mut SgTape, }