From a464ce819ccd1fa07ff8c6d0be74cff5eec5cf34 Mon Sep 17 00:00:00 2001 From: "Neal H. Walfield" Date: Fri, 31 Jan 2020 14:20:53 +0100 Subject: openpgp: Add a policy object. - Change all functions that need to evaluate the validity of a signature (either directly or indirectly to take a policy object. - Use the policy object to allow the user to place additional constraints on a signature's validity. - This addresses the first half of #274 (it introduces the policy object, but does not yet implement any policy). --- ipc/examples/gpg-agent-sign.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'ipc/examples/gpg-agent-sign.rs') diff --git a/ipc/examples/gpg-agent-sign.rs b/ipc/examples/gpg-agent-sign.rs index a80f3935..424f2a74 100644 --- a/ipc/examples/gpg-agent-sign.rs +++ b/ipc/examples/gpg-agent-sign.rs @@ -9,9 +9,12 @@ extern crate sequoia_ipc as ipc; use crate::openpgp::armor; use crate::openpgp::parse::Parse; use crate::openpgp::serialize::stream::{Message, LiteralWriter, Signer}; +use crate::openpgp::policy::StandardPolicy as P; use crate::ipc::gnupg::{Context, KeyPair}; fn main() { + let p = &P::new(); + let matches = clap::App::new("gpg-agent-sign") .version(env!("CARGO_PKG_VERSION")) .about("Connects to gpg-agent and creates a dummy signature.") @@ -39,7 +42,7 @@ fn main() { // Construct a KeyPair for every signing-capable (sub)key. let mut signers = certs.iter().flat_map(|cert| { - cert.keys().policy(None).alive().revoked(false).for_signing() + cert.keys().set_policy(p, None).alive().revoked(false).for_signing() .filter_map(|ka| { KeyPair::new(&ctx, ka.key()).ok() }) -- cgit v1.2.3