summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--guide/src/chapter_01.md8
-rw-r--r--openpgp-ffi/src/parse/stream.rs8
-rw-r--r--openpgp/examples/generate-sign-verify.rs2
-rw-r--r--openpgp/src/parse/stream.rs33
-rw-r--r--openpgp/src/serialize/stream.rs4
-rw-r--r--tool/src/commands/mod.rs4
6 files changed, 32 insertions, 27 deletions
diff --git a/guide/src/chapter_01.md b/guide/src/chapter_01.md
index 8e48a791..580a27d6 100644
--- a/guide/src/chapter_01.md
+++ b/guide/src/chapter_01.md
@@ -119,7 +119,7 @@ fn main() {
# // whether the signature checks out mathematically, we apply
# // our policy.
# match sig_result {
-# VerificationResult::GoodChecksum(_) =>
+# VerificationResult::GoodChecksum(..) =>
# Ok(()), // Good signature
# VerificationResult::MissingKey(_) =>
# Err(failure::err_msg("Missing key to verify signature")),
@@ -249,7 +249,7 @@ fn generate() -> openpgp::Result<openpgp::TPK> {
# // whether the signature checks out mathematically, we apply
# // our policy.
# match sig_result {
-# VerificationResult::GoodChecksum(_) =>
+# VerificationResult::GoodChecksum(..) =>
# Ok(()), // Good signature
# VerificationResult::MissingKey(_) =>
# Err(failure::err_msg("Missing key to verify signature")),
@@ -379,7 +379,7 @@ fn sign(sink: &mut Write, plaintext: &str, tsk: &openpgp::TPK)
# // whether the signature checks out mathematically, we apply
# // our policy.
# match sig_result {
-# VerificationResult::GoodChecksum(_) =>
+# VerificationResult::GoodChecksum(..) =>
# Ok(()), // Good signature
# VerificationResult::MissingKey(_) =>
# Err(failure::err_msg("Missing key to verify signature")),
@@ -520,7 +520,7 @@ impl<'a> VerificationHelper for Helper<'a> {
// whether the signature checks out mathematically, we apply
// our policy.
match sig_result {
- VerificationResult::GoodChecksum(_) =>
+ VerificationResult::GoodChecksum(..) =>
Ok(()), // Good signature
VerificationResult::MissingKey(_) =>
Err(failure::err_msg("Missing key to verify signature")),
diff --git a/openpgp-ffi/src/parse/stream.rs b/openpgp-ffi/src/parse/stream.rs
index 63db33a6..baf0ae05 100644
--- a/openpgp-ffi/src/parse/stream.rs
+++ b/openpgp-ffi/src/parse/stream.rs
@@ -91,7 +91,7 @@ pub extern "system" fn pgp_revocation_status_free(
///
/// Within each level, there can be one or more signatures.
pub struct VerificationResults<'a> {
- results: Vec<Vec<&'a VerificationResult>>,
+ results: Vec<Vec<&'a VerificationResult<'a>>>,
}
/// Returns the `VerificationResult`s at level `level.
@@ -109,7 +109,7 @@ pub struct VerificationResults<'a> {
#[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "system"
fn pgp_verification_results_at_level<'a>(results: *const VerificationResults<'a>,
level: size_t,
- r: *mut *const &'a VerificationResult,
+ r: *mut *const &'a VerificationResult<'a>,
r_count: *mut size_t) {
let results = ffi_param_ref!(results);
let r = ffi_param_ref_mut!(r);
@@ -131,7 +131,7 @@ fn pgp_verification_result_code(result: *const VerificationResult)
{
let result = ffi_param_ref!(result);
match result {
- VerificationResult::GoodChecksum(_) => 1,
+ VerificationResult::GoodChecksum(..) => 1,
VerificationResult::MissingKey(_) => 2,
VerificationResult::BadChecksum(_) => 3,
}
@@ -144,7 +144,7 @@ fn pgp_verification_result_signature(result: *const VerificationResult)
{
let result = ffi_param_ref!(result);
let sig = match result {
- VerificationResult::GoodChecksum(ref sig) => sig,
+ VerificationResult::GoodChecksum(ref sig, ..) => sig,
VerificationResult::MissingKey(ref sig) => sig,
VerificationResult::BadChecksum(ref sig) => sig,
};
diff --git a/openpgp/examples/generate-sign-verify.rs b/openpgp/examples/generate-sign-verify.rs
index 44afaf36..31138b4e 100644
--- a/openpgp/examples/generate-sign-verify.rs
+++ b/openpgp/examples/generate-sign-verify.rs
@@ -110,7 +110,7 @@ impl<'a> VerificationHelper for Helper<'a> {
// whether the signature checks out mathematically, we apply
// our policy.
match sig_result {
- VerificationResult::GoodChecksum(_) =>
+ VerificationResult::GoodChecksum(..) =>
Ok(()), // Good signature
VerificationResult::MissingKey(_) =>
Err(failure::err_msg("Missing key to verify signature")),
diff --git a/openpgp/src/parse/stream.rs b/openpgp/src/parse/stream.rs
index fc35a796..3f10b897 100644
--- a/openpgp/src/parse/stream.rs
+++ b/openpgp/src/parse/stream.rs
@@ -35,6 +35,7 @@ use {
KeyID,
Packet,
Result,
+ RevocationStatus,
packet,
packet::Signature,
TPK,
@@ -127,7 +128,7 @@ pub struct Verifier<'a, H: VerificationHelper> {
/// Contains the result of a signature verification.
#[derive(Debug)]
-pub enum VerificationResult {
+pub enum VerificationResult<'a> {
/// The signature is good.
///
/// Note: A signature is considered good if it can be
@@ -138,19 +139,20 @@ pub enum VerificationResult {
/// model, such as the [web of trust] (WoT).
///
/// [web of trust]: https://en.wikipedia.org/wiki/Web_of_trust
- GoodChecksum(Signature),
+ GoodChecksum(Signature,
+ &'a TPK, &'a Key, Option<&'a Signature>, RevocationStatus<'a>),
/// Unable to verify the signature because the key is missing.
MissingKey(Signature),
/// The signature is bad.
BadChecksum(Signature),
}
-impl VerificationResult {
+impl<'a> VerificationResult<'a> {
/// Simple forwarder.
pub fn level(&self) -> usize {
use self::VerificationResult::*;
match self {
- &GoodChecksum(ref sig) => sig.level(),
+ &GoodChecksum(ref sig, ..) => sig.level(),
&MissingKey(ref sig) => sig.level(),
&BadChecksum(ref sig) => sig.level(),
}
@@ -389,11 +391,12 @@ impl<'a, H: VerificationHelper> Verifier<'a, H> {
results.iter_mut().last().expect("never empty").push(
if let Some(issuer) = sig.get_issuer() {
if let Some((i, j)) = self.keys.get(&issuer) {
- let (_, _, key)
- = self.tpks[*i].keys_all().nth(*j)
- .unwrap();
+ let tpk = &self.tpks[*i];
+ let (binding, revocation, key)
+ = tpk.keys_all().nth(*j).unwrap();
if sig.verify(key).unwrap_or(false) {
- VerificationResult::GoodChecksum(sig)
+ VerificationResult::GoodChecksum
+ (sig, tpk, key, binding, revocation)
} else {
VerificationResult::BadChecksum(sig)
}
@@ -1119,9 +1122,9 @@ impl<'a, H: VerificationHelper + DecryptionHelper> Decryptor<'a, H> {
results.iter_mut().last().expect("never empty").push(
if let Some(issuer) = sig.get_issuer() {
if let Some((i, j)) = self.keys.get(&issuer) {
- let (_, _, key)
- = self.tpks[*i].keys_all().nth(*j)
- .unwrap();
+ let tpk = &self.tpks[*i];
+ let (binding, revocation, key)
+ = tpk.keys_all().nth(*j).unwrap();
if sig.verify(key).unwrap_or(false) {
// Check intended recipients.
if let Some(identity) =
@@ -1141,12 +1144,14 @@ impl<'a, H: VerificationHelper + DecryptionHelper> Decryptor<'a, H> {
(sig)
} else {
VerificationResult::GoodChecksum
- (sig)
+ (sig, tpk, key, binding,
+ revocation)
}
} else {
// No identity information.
VerificationResult::GoodChecksum
- (sig)
+ (sig, tpk, key, binding,
+ revocation)
}
} else {
VerificationResult::BadChecksum(sig)
@@ -1282,7 +1287,7 @@ mod test {
for level in sigs {
for result in level {
match result {
- GoodChecksum(_) => self.good += 1,
+ GoodChecksum(..) => self.good += 1,
MissingKey(_) => self.unknown += 1,
BadChecksum(_) => self.bad += 1,
}
diff --git a/openpgp/src/serialize/stream.rs b/openpgp/src/serialize/stream.rs
index 173a0329..0f513784 100644
--- a/openpgp/src/serialize/stream.rs
+++ b/openpgp/src/serialize/stream.rs
@@ -248,7 +248,7 @@ impl<'a> Signer<'a> {
///
/// fn check(&mut self, sigs: Vec<Vec<VerificationResult>>)
/// -> openpgp::Result<()> {
- /// if let VerificationResult::GoodChecksum(_) =
+ /// if let VerificationResult::GoodChecksum(..) =
/// sigs.get(0).unwrap().get(0).unwrap()
/// { Ok(()) /* good */ } else { panic!() }
/// }
@@ -331,7 +331,7 @@ impl<'a> Signer<'a> {
///
/// fn check(&mut self, sigs: Vec<Vec<VerificationResult>>)
/// -> openpgp::Result<()> {
- /// if let VerificationResult::GoodChecksum(_) =
+ /// if let VerificationResult::GoodChecksum(..) =
/// sigs.get(0).unwrap().get(0).unwrap()
/// { Ok(()) /* good */ } else { panic!() }
/// }
diff --git a/tool/src/commands/mod.rs b/tool/src/commands/mod.rs
index ca099eaf..feb3e41e 100644
--- a/tool/src/commands/mod.rs
+++ b/tool/src/commands/mod.rs
@@ -246,7 +246,7 @@ impl<'a> VerificationHelper for VHelper<'a> {
for (i, results) in sigs.into_iter().enumerate() {
for result in results {
let issuer = match result {
- GoodChecksum(ref sig) => sig.get_issuer(),
+ GoodChecksum(ref sig, ..) => sig.get_issuer(),
MissingKey(ref sig) => sig.get_issuer(),
BadChecksum(ref sig) => sig.get_issuer(),
};
@@ -263,7 +263,7 @@ impl<'a> VerificationHelper for VHelper<'a> {
};
match result {
- GoodChecksum(_) => {
+ GoodChecksum(..) => {
let issuer = issuer
.expect("good checksum has an issuer");
let issuer_str = format!("{}", issuer);