summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--openpgp/src/crypto/asymmetric.rs13
1 files changed, 12 insertions, 1 deletions
diff --git a/openpgp/src/crypto/asymmetric.rs b/openpgp/src/crypto/asymmetric.rs
index e23c3c73..ea8896e9 100644
--- a/openpgp/src/crypto/asymmetric.rs
+++ b/openpgp/src/crypto/asymmetric.rs
@@ -2,7 +2,7 @@
use nettle::{dsa, ecc, ecdsa, ed25519, rsa, Yarrow};
-use packet::Key;
+use packet::{self, Key};
use crypto::SessionKey;
use crypto::mpis::{self, MPI};
use constants::{Curve, HashAlgorithm};
@@ -246,3 +246,14 @@ impl Decryptor for KeyPair {
}.into())
}
}
+
+impl From<KeyPair> for packet::Key {
+ fn from(p: KeyPair) -> Self {
+ let (mut key, secret) = (p.public, p.secret);
+ key.set_secret(Some(packet::key::SecretKey::Unencrypted {
+ mpis: secret,
+ }));
+ key
+ }
+
+}