Skip to content

Commit

Permalink
Add Zeroize impl for SigningKey (#34)
Browse files Browse the repository at this point in the history
* Add Zeroize impl for SigningKey
  • Loading branch information
kim committed Dec 3, 2020
1 parent 014d823 commit 0e7a96a
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ rand_core = "0.5"
thiserror = "1"
curve25519-dalek = "3"
serde = { version = "1", optional = true, features = ["derive"] }
zeroize = "1.1"

[dev-dependencies]
rand = "0.7"
Expand Down
7 changes: 7 additions & 0 deletions src/signing_key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,13 @@ impl From<[u8; 32]> for SigningKey {
}
}

impl zeroize::Zeroize for SigningKey {
fn zeroize(&mut self) {
self.seed.zeroize();
self.s.zeroize()
}
}

#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
struct SerdeHelper([u8; 32]);

Expand Down

0 comments on commit 0e7a96a

Please sign in to comment.