summaryrefslogtreecommitdiffstats
path: root/openpgp/examples/sign-detached.rs
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@pep.foundation>2020-01-31 14:20:53 +0100
committerNeal H. Walfield <neal@pep.foundation>2020-01-31 15:59:16 +0100
commita464ce819ccd1fa07ff8c6d0be74cff5eec5cf34 (patch)
tree31ed9d18b9c7802a93b4e4c8e6e85d1121b201d8 /openpgp/examples/sign-detached.rs
parentb9b6533bd5394cd5cdb6b91b5c5ca7a02e3ea199 (diff)
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).
Diffstat (limited to 'openpgp/examples/sign-detached.rs')
-rw-r--r--openpgp/examples/sign-detached.rs4
1 files changed, 3 insertions, 1 deletions
diff --git a/openpgp/examples/sign-detached.rs b/openpgp/examples/sign-detached.rs
index 4d228f34..e93cd0e2 100644
--- a/openpgp/examples/sign-detached.rs
+++ b/openpgp/examples/sign-detached.rs
@@ -8,8 +8,10 @@ extern crate sequoia_openpgp as openpgp;
use crate::openpgp::armor;
use crate::openpgp::parse::Parse;
use crate::openpgp::serialize::stream::{Message, Signer};
+use crate::openpgp::policy::StandardPolicy as P;
fn main() {
+ let p = &P::new();
let args: Vec<String> = env::args().collect();
if args.len() < 2 {
panic!("A simple filter creating a detached signature.\n\n\
@@ -25,7 +27,7 @@ fn main() {
let mut n = 0;
for key in tsk
- .keys().policy(None).alive().revoked(false).for_signing().secret()
+ .keys().set_policy(p, None).alive().revoked(false).for_signing().secret()
.map(|ka| ka.key())
{
keys.push({