summaryrefslogtreecommitdiffstats
path: root/openpgp
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2019-12-09 12:32:35 +0100
committerJustus Winter <justus@sequoia-pgp.org>2019-12-09 13:28:28 +0100
commit88f43e115383c89fb83714e5dd6fbd2f9df16047 (patch)
tree865b76d3e02ac77b69b80eeac321f0105e1ff3a4 /openpgp
parentfe8093bc1aef8c6a79fd1dc76f5cc857eae05d50 (diff)
openpgp: Return result from Cert::alive, remove Cert::expired.
- See #371.
Diffstat (limited to 'openpgp')
-rw-r--r--openpgp/src/cert/mod.rs18
1 files changed, 3 insertions, 15 deletions
diff --git a/openpgp/src/cert/mod.rs b/openpgp/src/cert/mod.rs
index ff209d0b..a118dc62 100644
--- a/openpgp/src/cert/mod.rs
+++ b/openpgp/src/cert/mod.rs
@@ -1109,27 +1109,15 @@ impl Cert {
self.merge_packets(vec![sig.into()])
}
- /// Returns whether or not the Cert is expired at `t`.
- pub fn expired<T>(&self, t: T) -> bool
- where T: Into<Option<time::SystemTime>>
- {
- let t = t.into();
- if let Some(Signature::V4(sig)) = self.primary_key_signature(t) {
- sig.key_expired(self.primary(), t)
- } else {
- false
- }
- }
-
/// Returns whether or not the Cert is alive at `t`.
- pub fn alive<T>(&self, t: T) -> bool
+ pub fn alive<T>(&self, t: T) -> Result<()>
where T: Into<Option<time::SystemTime>>
{
let t = t.into();
if let Some(sig) = self.primary_key_signature(t) {
- sig.key_alive(self.primary(), t).is_ok()
+ sig.key_alive(self.primary(), t)
} else {
- false
+ Err(Error::MalformedCert("No primary key signature".into()).into())
}
}