Skip to content

Commit

Permalink
feat: add zeroize support
Browse files Browse the repository at this point in the history
  • Loading branch information
palozano committed Dec 11, 2023
1 parent d3238ec commit e1ab2e5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
4 changes: 3 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ ff = "0.13"
group = "0.13"
pairing_lib = { version = "0.23.0", package = "pairing" }

bls12_381 = { version = "0.8.0", optional = true, features = ["experimental"] }
bls12_381 = { version = "0.8.0", optional = true, features = ["experimental", "zeroize"] }
sha2 = { version = "0.9", optional = true }
hkdf = { version = "0.11.0", optional = true }

blst_lib = { version = "0.3.10", optional = true, package = "blst" }
blstrs = { version = "0.7.0", optional = true }

zeroize = { version = "1.7", features = ["derive"] }

[features]
default = ["pairing", "multicore"]
multicore = ["rayon"]
Expand Down
3 changes: 2 additions & 1 deletion src/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use bls12_381::{hash_to_curve::HashToField, G1Affine, G1Projective, Scalar};
use hkdf::Hkdf;
#[cfg(feature = "pairing")]
use sha2::{digest::generic_array::typenum::U48, digest::generic_array::GenericArray, Sha256};
use zeroize::Zeroize;

#[cfg(feature = "blst")]
use blstrs::{G1Affine, G1Projective, G2Affine, Scalar};
Expand All @@ -26,7 +27,7 @@ pub(crate) const G1_COMPRESSED_SIZE: usize = 48;
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub struct PublicKey(pub(crate) G1Projective);

#[derive(Debug, Copy, Clone, Eq, PartialEq)]
#[derive(Debug, Copy, Clone, Eq, PartialEq, Zeroize)]
pub struct PrivateKey(pub(crate) Scalar);

impl From<G1Projective> for PublicKey {
Expand Down

0 comments on commit e1ab2e5

Please sign in to comment.