From 55eca2c87e63d64202f8bedb500b63419d5f2196 Mon Sep 17 00:00:00 2001 From: Justus Winter Date: Mon, 20 Nov 2023 18:31:11 +0100 Subject: [PATCH] Use sequoia-policy-config to configure the StandardPolicy. - This allows users to tweak the StandardPolicy used by Sequoia to evaluate cryptographic artifacts. For example, on Fedora it will adhere to the system-wide cryptographic policy for Sequoia. - Fixes #128. --- Cargo.lock | 1 + Cargo.toml | 1 + src/sq.rs | 6 ++++-- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c7f9a658..0ac0976c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2977,6 +2977,7 @@ dependencies = [ "sequoia-cert-store", "sequoia-net", "sequoia-openpgp", + "sequoia-policy-config", "sequoia-wot", "serde", "serde_json", diff --git a/Cargo.toml b/Cargo.toml index 9b69c555..51ddae8e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,6 +35,7 @@ dot-writer = "0.1.3" sequoia-openpgp = { version = "1.13", default-features = false, features = ["compression-deflate"] } sequoia-autocrypt = { version = "0.25", default-features = false, optional = true } sequoia-net = { version = "0.27", default-features = false } +sequoia-policy-config = "0.6" anyhow = "1.0.18" chrono = "0.4.10" # For an MSRV of 1.63: 4.0.32. diff --git a/src/sq.rs b/src/sq.rs index 5e2ecedc..a623ee03 100644 --- a/src/sq.rs +++ b/src/sq.rs @@ -1002,7 +1002,9 @@ fn main() -> Result<()> { .into() }; - let policy = &mut P::at(time); + let mut policy = sequoia_policy_config::ConfiguredStandardPolicy::new(); + policy.parse_default_config()?; + let mut policy = policy.build(); let known_notations = c.known_notation .iter() @@ -1022,7 +1024,7 @@ fn main() -> Result<()> { force, output_format, output_version, - policy: policy.clone(), + policy, time, no_rw_cert_store: c.no_cert_store, cert_store_path: c.cert_store.clone(),