summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--openpgp-ffi/include/sequoia/openpgp.h7
-rw-r--r--openpgp-ffi/src/packet/signature.rs13
-rw-r--r--openpgp/src/packet/signature/subpacket.rs39
3 files changed, 1 insertions, 58 deletions
diff --git a/openpgp-ffi/include/sequoia/openpgp.h b/openpgp-ffi/include/sequoia/openpgp.h
index a5e4b603..6e966fba 100644
--- a/openpgp-ffi/include/sequoia/openpgp.h
+++ b/openpgp-ffi/include/sequoia/openpgp.h
@@ -487,13 +487,6 @@ pgp_status_t pgp_signature_alive_with_tolerance(pgp_error_t *errp,
unsigned int tolerance);
/*/
-/// Returns whether the signature is expired at the specified time.
-///
-/// If `when` is 0, then the current time is used.
-/*/
-bool pgp_signature_expired(pgp_signature_t signature, time_t when);
-
-/*/
/// Returns whether the signature is alive at the specified time.
///
/// A signature is alive if the creation date is in the past, and the
diff --git a/openpgp-ffi/src/packet/signature.rs b/openpgp-ffi/src/packet/signature.rs
index 7e50f3a1..6ce3c0ac 100644
--- a/openpgp-ffi/src/packet/signature.rs
+++ b/openpgp-ffi/src/packet/signature.rs
@@ -244,19 +244,6 @@ fn pgp_signature_alive_with_tolerance(errp: Option<&mut *mut crate::error::Error
ffi_try_status!(sig.ref_raw().signature_alive(time, Some(tolerance)))
}
-/// Returns whether the signature is expired at the specified time.
-///
-/// If `when` is 0, then the current time is used.
-#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C"
-fn pgp_signature_expired(sig: *const Signature, when: time_t) -> bool {
- let t = if when == 0 {
- None
- } else {
- Some(std::time::UNIX_EPOCH + std::time::Duration::new(when as u64, 0))
- };
- sig.ref_raw().signature_expired(t).is_ok()
-}
-
/// Returns whether the signature is alive at the specified time.
///
/// A signature is alive if the creation date is in the past, and the
diff --git a/openpgp/src/packet/signature/subpacket.rs b/openpgp/src/packet/signature/subpacket.rs
index 8a04906b..cd4957e4 100644
--- a/openpgp/src/packet/signature/subpacket.rs
+++ b/openpgp/src/packet/signature/subpacket.rs
@@ -2080,36 +2080,6 @@ impl SubpacketAreas {
self.unhashed_area().lookup(tag)
}
- /// Returns whether or not the signature is expired at the given time.
- ///
- /// If `t` is None, uses the current time.
- ///
- /// Note that [Section 5.2.3.4 of RFC 4880] states that "[[A
- /// Signature Creation Time subpacket]] MUST be present in the
- /// hashed area." Consequently, if such a packet does not exist,
- /// but a "Signature Expiration Time" subpacket exists, we
- /// conservatively treat the signature as expired, because there
- /// is no way to evaluate the expiration time.
- ///
- /// [Section 5.2.3.4 of RFC 4880]: https://tools.ietf.org/html/rfc4880#section-5.2.3.4
- pub fn signature_expired<T>(&self, t: T) -> bool
- where T: Into<Option<time::SystemTime>>
- {
- let t = t.into()
- .unwrap_or_else(|| time::SystemTime::now());
- match (self.signature_creation_time(), self.signature_expiration_time())
- {
- (Some(_), Some(e)) if e.as_secs() == 0 =>
- false, // Zero expiration time, does not expire.
- (Some(c), Some(e)) =>
- (c + e) <= t,
- (None, Some(_)) =>
- true, // No creation time, treat as always expired.
- (_, None) =>
- false, // No expiration time, does not expire.
- }
- }
-
/// Returns whether or not the signature is alive at the specified
/// time.
///
@@ -2764,10 +2734,6 @@ fn accessors() {
sig.clone().sign_hash(&mut keypair, hash.clone()).unwrap();
assert_eq!(sig_.signature_expiration_time(), Some(five_minutes));
- assert!(!sig_.signature_expired(None));
- assert!(!sig_.signature_expired(now));
- assert!(sig_.signature_expired(now + ten_minutes));
-
assert!(sig_.signature_alive(None, zero_s).is_ok());
assert!(sig_.signature_alive(now, zero_s).is_ok());
assert!(!sig_.signature_alive(now - five_minutes, zero_s).is_ok());
@@ -2777,9 +2743,6 @@ fn accessors() {
let sig_ =
sig.clone().sign_hash(&mut keypair, hash.clone()).unwrap();
assert_eq!(sig_.signature_expiration_time(), None);
- assert!(!sig_.signature_expired(None));
- assert!(!sig_.signature_expired(now));
- assert!(!sig_.signature_expired(now + ten_minutes));
assert!(sig_.signature_alive(None, zero_s).is_ok());
assert!(sig_.signature_alive(now, zero_s).is_ok());
@@ -3109,7 +3072,7 @@ fn subpacket_test_2() {
}));
// The signature does not expire.
- assert!(! sig.signature_expired(None));
+ assert!(sig.signature_alive(None, None).is_ok());
assert_eq!(sig.key_expiration_time(),
Some(Duration::from(63072000).into()));