From f12bc77a76631579d1e102c5882b1964745c3d60 Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Mon, 2 Oct 2023 12:14:57 +0200 Subject: openpgp: Test that v3 revocation signatures are honored. - Fixes #954. --- openpgp/src/cert.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) (limited to 'openpgp/src/cert.rs') diff --git a/openpgp/src/cert.rs b/openpgp/src/cert.rs index fd5f5d0d..e1ba1b6a 100644 --- a/openpgp/src/cert.rs +++ b/openpgp/src/cert.rs @@ -7286,4 +7286,25 @@ Pu1xwz57O4zo1VYf6TqHJzVC3OMvMUM2hhdecMUe5x6GorNaj6g= Ok(()) } + + /// Tests v3 revocation signatures. + #[test] + fn v3_revocation_signature() -> Result<()> { + if ! crate::types::PublicKeyAlgorithm::ECDSA.is_supported() + || ! crate::types::Curve::NistP521.is_supported() + { + eprintln!("Skipping because ECDSA/NistP521 is not supported"); + return Ok(()); + } + + let c = Cert::from_bytes( + crate::tests::key("v4-revoked-by-v3.pgp"))?; + assert_eq!(c.bad_signatures().count(), 0); + + let sp = crate::policy::StandardPolicy::new(); + assert!(matches!(c.revocation_status(&sp, None), + RevocationStatus::Revoked(_))); + + Ok(()) + } } -- cgit v1.2.3