summaryrefslogtreecommitdiffstats
path: root/openpgp
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2020-04-15 13:43:50 +0200
committerJustus Winter <justus@sequoia-pgp.org>2020-04-15 15:48:23 +0200
commitea8100e60c19a6be793d3c88fb54b832b65031e5 (patch)
tree36dd2c3174f407e30c3169c9c3bf3086bad930f4 /openpgp
parentcab27418a20ecb42a0084073051b405648cb100b (diff)
openpgp: Drop Cert::alive.
- See #484.
Diffstat (limited to 'openpgp')
-rw-r--r--openpgp/src/cert/mod.rs19
1 files changed, 3 insertions, 16 deletions
diff --git a/openpgp/src/cert/mod.rs b/openpgp/src/cert/mod.rs
index c228b03c..b3ab1ca4 100644
--- a/openpgp/src/cert/mod.rs
+++ b/openpgp/src/cert/mod.rs
@@ -146,8 +146,6 @@ use std::fmt;
use std::ops::{Deref, DerefMut};
use std::time;
-use anyhow::Context;
-
use crate::{
crypto::Signer,
Error,
@@ -771,18 +769,6 @@ impl Cert {
self.merge_packets(vec![sig.into()])
}
- /// Returns whether or not the Cert is alive at `t`.
- pub fn alive<T>(&self, policy: &dyn Policy, t: T) -> Result<()>
-
- where T: Into<Option<time::SystemTime>>
- {
- let t = t.into();
- self.primary_key()
- .with_policy(policy, t).context(
- "primary key rejected by policy")?
- .alive()
- }
-
/// Sets the key to expire in delta seconds.
///
/// Note: the time is relative to the key's creation time, not the
@@ -1667,7 +1653,7 @@ impl<'a> ValidCert<'a> {
/// Returns whether or not the Cert is alive.
pub fn alive(&self) -> Result<()> {
- self.cert.alive(self.policy, self.time)
+ self.primary_key().alive()
}
/// Returns the amalgamated primary key.
@@ -3585,7 +3571,8 @@ Pu1xwz57O4zo1VYf6TqHJzVC3OMvMUM2hhdecMUe5x6GorNaj6g=
"issue-215-expiration-on-direct-key-sig.pgp")).unwrap();
assert_match!(
Error::Expired(_)
- = cert.alive(p, None).unwrap_err().downcast().unwrap());
+ = cert.with_policy(p, None).unwrap().alive()
+ .unwrap_err().downcast().unwrap());
assert_match!(
Error::Expired(_)
= cert.primary_key().with_policy(p, None).unwrap()