Skip to content

Commit

Permalink
Merge branch 'tiago/zeroize-secret-keys' (#1956)
Browse files Browse the repository at this point in the history
  • Loading branch information
sug0 committed Oct 13, 2023
2 parents 21c5e58 + 5d7c951 commit 03b1856
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
- Tag `ed25519` keys with `ZeroizeOnDrop`
([\#1958](https://github.com/anoma/namada/pull/1958))
10 changes: 2 additions & 8 deletions core/src/types/key/ed25519.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use data_encoding::HEXLOWER;
#[cfg(feature = "rand")]
use rand::{CryptoRng, RngCore};
use serde::{Deserialize, Serialize};
use zeroize::Zeroize;
use zeroize::{Zeroize, ZeroizeOnDrop};

use super::{
ParsePublicKeyError, ParseSecretKeyError, ParseSignatureError, RefTo,
Expand Down Expand Up @@ -125,7 +125,7 @@ impl FromStr for PublicKey {
}

/// Ed25519 secret key
#[derive(Debug, Serialize, Deserialize, Zeroize)]
#[derive(Debug, Serialize, Deserialize, Zeroize, ZeroizeOnDrop)]
pub struct SecretKey(pub Box<ed25519_consensus::SigningKey>);

impl super::SecretKey for SecretKey {
Expand Down Expand Up @@ -223,12 +223,6 @@ impl FromStr for SecretKey {
}
}

impl Drop for SecretKey {
fn drop(&mut self) {
self.0.zeroize();
}
}

/// Ed25519 signature
#[derive(Clone, Debug, Eq, PartialEq, Serialize, Deserialize)]
pub struct Signature(pub ed25519_consensus::Signature);
Expand Down

0 comments on commit 03b1856

Please sign in to comment.