summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2022-02-25 14:03:10 +0100
committerJustus Winter <justus@sequoia-pgp.org>2022-02-25 15:02:51 +0100
commit7e158e6b7c878bccef77c2f524a9c25128577cbf (patch)
tree8cb34acd4a09003a2f7370989faef62f3dcfccb7
parent0fb0297f0297cf6c048216a357d65a3689a0bdb5 (diff)
openpgp: Improve error messages regarding expiration.
- Add context to ValidKeyAmalgamation::alive that explain why a (sub)key is not alive.
-rw-r--r--openpgp/src/cert/amalgamation/key.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/openpgp/src/cert/amalgamation/key.rs b/openpgp/src/cert/amalgamation/key.rs
index da95504c..42e89c72 100644
--- a/openpgp/src/cert/amalgamation/key.rs
+++ b/openpgp/src/cert/amalgamation/key.rs
@@ -1336,7 +1336,8 @@ impl<'a, P, R, R2> ValidKeyAmalgamation<'a, P, R, R2>
{
if ! self.primary() {
// First, check the certificate.
- self.cert().alive()?;
+ self.cert().alive()
+ .context("The certificate is not live")?;
}
let sig = {
@@ -1349,6 +1350,11 @@ impl<'a, P, R, R2> ValidKeyAmalgamation<'a, P, R, R2>
};
if let Some(sig) = sig {
sig.key_alive(self.key(), self.time())
+ .context(if self.primary() {
+ "The primary key is not live"
+ } else {
+ "The subkey is not live"
+ })
} else {
// There is no key expiration time on the binding
// signature. This key does not expire.