summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--openpgp/src/packet/signature/mod.rs11
-rw-r--r--openpgp/src/tpk/builder.rs4
2 files changed, 8 insertions, 7 deletions
diff --git a/openpgp/src/packet/signature/mod.rs b/openpgp/src/packet/signature/mod.rs
index fb947cc4..bc7239c5 100644
--- a/openpgp/src/packet/signature/mod.rs
+++ b/openpgp/src/packet/signature/mod.rs
@@ -119,16 +119,15 @@ impl Builder {
/// The Signature's public-key algorithm field is set to the
/// algorithm used by `signer`, the hash-algorithm field is set to
/// `hash_algo`.
- pub fn sign_primary_key_binding(mut self, signer: &Key, signer_sec: &mpis::SecretKey,
+ pub fn sign_primary_key_binding(mut self, signer: &mut Signer,
algo: HashAlgorithm)
-> Result<Signature> {
-
- self.pk_algo = signer.pk_algo();
+ self.pk_algo = signer.public().pk_algo();
self.hash_algo = algo;
- let digest = Signature::primary_key_binding_hash(&self, signer);
+ let digest =
+ Signature::primary_key_binding_hash(&self, signer.public());
- let mut signer = KeyPair::new(signer, signer_sec)?;
- self.sign(&mut signer, digest)
+ self.sign(signer, digest)
}
/// Signs binding between `userid` and `key` using `signer`.
diff --git a/openpgp/src/tpk/builder.rs b/openpgp/src/tpk/builder.rs
index 3ef3acc2..3ef14856 100644
--- a/openpgp/src/tpk/builder.rs
+++ b/openpgp/src/tpk/builder.rs
@@ -244,7 +244,9 @@ impl TPKBuilder {
Some(uid) => sig.sign_userid_binding(
&mut KeyPair::new(&key, mpis)?, &key, &uid,
HashAlgorithm::SHA512)?,
- None => sig.sign_primary_key_binding(&key, mpis, HashAlgorithm::SHA512)?,
+ None => sig.sign_primary_key_binding(
+ &mut KeyPair::new(&key, mpis)?,
+ HashAlgorithm::SHA512)?,
}
}
Some(SecretKey::Encrypted{ .. }) => {