mirror of
https://github.com/saymrwulf/anza-cryptography-source.git
synced 2026-09-04 20:24:04 +00:00
impl zeroize for signing key (#16)
This commit is contained in:
parent
3a141c3fe3
commit
1b728159eb
1 changed files with 10 additions and 1 deletions
|
|
@ -56,7 +56,7 @@ pub type SecretKey = [u8; SECRET_KEY_LENGTH];
|
|||
/// An Ed25519 signing key.
|
||||
///
|
||||
/// This is also called a secret key by other implementations.
|
||||
#[derive(Copy, Clone, Zeroize)]
|
||||
#[derive(Copy, Clone)]
|
||||
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
|
||||
#[cfg_attr(feature = "serde", serde(from = "SerdeHelper"))]
|
||||
#[cfg_attr(feature = "serde", serde(into = "SerdeHelper"))]
|
||||
|
|
@ -67,6 +67,15 @@ pub struct SigningKey {
|
|||
vk: VerificationKey,
|
||||
}
|
||||
|
||||
impl Zeroize for SigningKey {
|
||||
fn zeroize(&mut self) {
|
||||
self.seed.zeroize();
|
||||
self.s.zeroize();
|
||||
self.prefix.zeroize();
|
||||
self.vk.zeroize();
|
||||
}
|
||||
}
|
||||
|
||||
impl core::fmt::Debug for SigningKey {
|
||||
fn fmt(&self, fmt: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
|
||||
fmt.debug_struct("SigningKey")
|
||||
|
|
|
|||
Loading…
Reference in a new issue