Skip to content

Commit

Permalink
feat: add zeroize to memory_key_manager (#6446)
Browse files Browse the repository at this point in the history
Description
---
add zeroize to memory_key_manager secrets

Motivation and Context
---
Secrets should be zeroized after use

Co-authored-by: stringhandler <[email protected]>
  • Loading branch information
SWvheerden and stringhandler authored Aug 5, 2024
1 parent 016ccf6 commit caa7097
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ pub fn create_memory_db_key_manager_from_seed(
let connection = DbConnection::connect_url(&DbConnectionUrl::MemoryShared(random_string(8)))?;
let cipher = seed;

let mut key = [0u8; size_of::<Key>()];
OsRng.fill_bytes(&mut key);
let key_ga = Key::from_slice(&key);
let mut key = Zeroizing::new([0u8; size_of::<Key>()]);
OsRng.fill_bytes(key.as_mut());
let key_ga = Key::from_slice(key.as_ref());
let db_cipher = XChaCha20Poly1305::new(key_ga);
let factory = CryptoFactories::new(rangeproof_size);

Expand Down

0 comments on commit caa7097

Please sign in to comment.