diff options
author | Neal H. Walfield <neal@pep.foundation> | 2020-04-07 13:31:15 +0200 |
---|---|---|
committer | Neal H. Walfield <neal@pep.foundation> | 2020-04-07 13:31:15 +0200 |
commit | ad365cf87e3b45b34600b3f5eb4390ad940ee077 (patch) | |
tree | 00d1a8c211148b18794632cc10840ed3a0a3db4a /openpgp | |
parent | d4a92bf1efbb9d39b5039e8bef15bf8ce34a22b9 (diff) |
openpgp: Remove redundant implementations of direct_key_signature
- Provide a default implementation of
`ValidAmalgamation::direct_key_signature`, which is sufficient for
all implementations of the trait.
Diffstat (limited to 'openpgp')
-rw-r--r-- | openpgp/src/cert/amalgamation.rs | 14 | ||||
-rw-r--r-- | openpgp/src/cert/amalgamation/key.rs | 4 |
2 files changed, 4 insertions, 14 deletions
diff --git a/openpgp/src/cert/amalgamation.rs b/openpgp/src/cert/amalgamation.rs index 1d454686..f9a06d94 100644 --- a/openpgp/src/cert/amalgamation.rs +++ b/openpgp/src/cert/amalgamation.rs @@ -157,7 +157,10 @@ pub trait ValidAmalgamation<'a, C: 'a> /// /// Subpackets on direct key signatures apply to all components of /// the certificate. - fn direct_key_signature(&self) -> Result<&'a Signature>; + fn direct_key_signature(&self) -> Result<&'a Signature> { + self.cert().cert.primary.binding_signature(self.policy(), self.time()) + } + /// Returns the component's revocation status as of the amalgamation's /// reference time. @@ -807,15 +810,6 @@ impl<'a, C> ValidAmalgamation<'a, C> for ValidComponentAmalgamation<'a, C> { self.binding_signature } - /// 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. - fn direct_key_signature(&self) -> Result<&'a Signature> { - self.cert.cert.primary.binding_signature(self.policy(), self.time()) - } - /// Returns the component's revocation status as of the amalgamation's /// reference time. /// diff --git a/openpgp/src/cert/amalgamation/key.rs b/openpgp/src/cert/amalgamation/key.rs index fc0210ed..a6800f74 100644 --- a/openpgp/src/cert/amalgamation/key.rs +++ b/openpgp/src/cert/amalgamation/key.rs @@ -692,10 +692,6 @@ impl<'a, P, R, R2> ValidAmalgamation<'a, Key<P, R>> self.binding_signature } - fn direct_key_signature(&self) -> Result<&'a Signature> { - self.cert.cert.primary.binding_signature(self.policy(), self.time()) - } - fn revoked(&self) -> RevocationStatus<'a> { if self.primary() { self.cert.revoked() |