aboutsummaryrefslogtreecommitdiffhomepage
path: root/oxish-graviola
diff options
context:
space:
mode:
Diffstat (limited to 'oxish-graviola')
-rw-r--r--oxish-graviola/src/lib.rs12
1 files changed, 12 insertions, 0 deletions
diff --git a/oxish-graviola/src/lib.rs b/oxish-graviola/src/lib.rs
index 7cccdbf..ebe1fc9 100644
--- a/oxish-graviola/src/lib.rs
+++ b/oxish-graviola/src/lib.rs
@@ -385,6 +385,12 @@ impl SigningKey for Ed25519Key {
fn algorithm(&self) -> PublicKeyAlgorithm<'static> {
PublicKeyAlgorithm::Ed25519
}
+
+ fn private_key(&self) -> Result<Zeroizing<Vec<u8>>, CryptoError> {
+ // as_seed() returns an owned copy, so wrap it too
+ let seed = Zeroizing::new(self.key.as_seed());
+ Ok(Zeroizing::new(seed.to_vec()))
+ }
}
struct EcdsaP256Key {
@@ -418,6 +424,12 @@ impl SigningKey for EcdsaP256Key {
fn algorithm(&self) -> PublicKeyAlgorithm<'static> {
PublicKeyAlgorithm::EcdsaSha2Nistp256
}
+
+ fn private_key(&self) -> Result<Zeroizing<Vec<u8>>, CryptoError> {
+ // as_bytes() returns an owned copy, so wrap it too
+ let d = Zeroizing::new(self.key.private_key.as_bytes());
+ Ok(Zeroizing::new(d.to_vec()))
+ }
}
struct EcdsaP256VerifyingKey(ecdsa::VerifyingKey<P256>);