summaryrefslogtreecommitdiffstats
path: root/openpgp/src/tpk/builder.rs
diff options
context:
space:
mode:
Diffstat (limited to 'openpgp/src/tpk/builder.rs')
-rw-r--r--openpgp/src/tpk/builder.rs10
1 files changed, 9 insertions, 1 deletions
diff --git a/openpgp/src/tpk/builder.rs b/openpgp/src/tpk/builder.rs
index fa145720..4723157f 100644
--- a/openpgp/src/tpk/builder.rs
+++ b/openpgp/src/tpk/builder.rs
@@ -7,6 +7,7 @@ use crypto::KeyPair;
use SymmetricAlgorithm;
use HashAlgorithm;
use packet::signature::{self, Signature};
+use packet::key::SecretKey;
use TPK;
use PublicKeyAlgorithm;
use Error;
@@ -207,7 +208,14 @@ impl TPKBuilder {
let tpk = TPK::from_packet_pile(PacketPile::from_packets(packets))?;
- let revocation = tpk.revoke(ReasonForRevocation::Unspecified,
+ let sec =
+ if let Some(SecretKey::Unencrypted { ref mpis }) = primary.secret() {
+ mpis.clone()
+ } else {
+ unreachable!()
+ };
+ let revocation = tpk.revoke(&mut KeyPair::new(primary, sec)?,
+ ReasonForRevocation::Unspecified,
b"Unspecified")?;
// keys generated by the builder are never invalid