diff options
author | Neal H. Walfield <neal@pep.foundation> | 2020-03-31 09:25:27 +0200 |
---|---|---|
committer | Neal H. Walfield <neal@pep.foundation> | 2020-03-31 21:22:02 +0200 |
commit | f4e2ccaad808ca83094d07eef7a6e03fc3625bc7 (patch) | |
tree | 43678ce0e56a48887c92265253bd4272b9f25a3e | |
parent | 98c111bb3f266a40f7e81513a5566d5e25aa4cf6 (diff) |
openpgp: Add a direct_key_signature method for Cert and ValidCert.
-rw-r--r-- | openpgp/src/cert/mod.rs | 22 |
1 files changed, 22 insertions, 0 deletions
diff --git a/openpgp/src/cert/mod.rs b/openpgp/src/cert/mod.rs index 26b35bf6..b6f12c2e 100644 --- a/openpgp/src/cert/mod.rs +++ b/openpgp/src/cert/mod.rs @@ -480,6 +480,18 @@ impl Cert { PrimaryKeyAmalgamation::new(&self) } + /// Returns the Certificate's direct key signature as of the + /// reference time, if any. + /// + /// Subpackets on direct key signatures apply to all components of + /// the certificate. + pub fn direct_key_signature<T>(&self, policy: &dyn Policy, t: T) + -> Result<&Signature> + where T: Into<Option<time::SystemTime>> + { + self.primary.binding_signature(policy, t) + } + /// Returns the Cert's revocation status at time `t`. /// /// A Cert is revoked at time `t` if: @@ -1424,6 +1436,16 @@ impl<'a> ValidCert<'a> { self.cert.with_policy(policy, time) } + /// Returns the Certificate's direct key signature as of the + /// reference time, if any. + /// + /// Subpackets on direct key signatures apply to all components of + /// the certificate. + pub fn direct_key_signature(&self) -> Result<&'a Signature> + { + self.cert.direct_key_signature(self.policy(), self.time()) + } + /// Returns the Cert's revocation status. /// /// A Cert is revoked if: |