summaryrefslogtreecommitdiffstats
path: root/openpgp/src/crypto
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2019-12-16 11:51:33 +0100
committerJustus Winter <justus@sequoia-pgp.org>2019-12-16 11:51:33 +0100
commit94babb06f0210666fcb70415f37de5566d3a7834 (patch)
tree8ecabe57163ef6b7423d453121b40a5a39c4f2e6 /openpgp/src/crypto
parent139aa5527f9b0d400151f26187bcd27f261973bd (diff)
openpgp: Add methods for primary key binding signatures.
- Fixes #402.
Diffstat (limited to 'openpgp/src/crypto')
-rw-r--r--openpgp/src/crypto/hash.rs14
1 files changed, 14 insertions, 0 deletions
diff --git a/openpgp/src/crypto/hash.rs b/openpgp/src/crypto/hash.rs
index 12502c10..539970f1 100644
--- a/openpgp/src/crypto/hash.rs
+++ b/openpgp/src/crypto/hash.rs
@@ -415,6 +415,20 @@ impl Signature {
Ok(digest)
}
+ /// Returns the message digest of the primary key binding over the
+ /// specified primary key and subkey.
+ pub fn hash_primary_key_binding<'a, P, Q, S>(
+ sig: S,
+ key: &Key<P, key::PrimaryRole>,
+ subkey: &Key<Q, key::SubordinateRole>)
+ -> Result<Vec<u8>>
+ where P: key::KeyParts,
+ Q: key::KeyParts,
+ S: Into<&'a signature::Builder>
+ {
+ Self::hash_subkey_binding(sig.into(), key, subkey)
+ }
+
/// Returns the message digest of the user ID binding over the
/// specified primary key, user ID, and signature.
pub fn hash_userid_binding<'a, S>(sig: S,