summaryrefslogtreecommitdiffstats
path: root/openpgp
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2018-12-19 13:26:46 +0100
committerJustus Winter <justus@sequoia-pgp.org>2018-12-19 14:08:30 +0100
commitb7d298d544afaca714bf07aca72c125c16192c72 (patch)
treec9393486bd379253b51fb0acd4ba9503fbbeaca6 /openpgp
parentb5fc75c86178bf4012f526f1a83a40802772e3de (diff)
openpgp: Make primary_key_binding use Signer.
Diffstat (limited to 'openpgp')
-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{ .. }) => {