diff options
author | Neal H. Walfield <neal@pep.foundation> | 2020-01-06 22:36:01 +0100 |
---|---|---|
committer | Neal H. Walfield <neal@pep.foundation> | 2020-01-06 23:01:29 +0100 |
commit | fc6ded10e255a2fc4423e7f360951a2f3eed5d6f (patch) | |
tree | b478c144171354bbf518a0d94d371a75139a94b4 /ipc/examples | |
parent | fe16487556c2b4d16400515aea8c448b0890e74c (diff) |
openpgp: Use KeyAmalgamation::for_xxx instead of building a KeyFlags
- Use the convenient functions
KeyAmalgamation::for_storage_encryption,
KeyAmalgamation::for_transport_encryption, etc., instead of
building up a KeyFlags and then calling
KeyAmalgamation::key_flags.
- This pattern requires less boilerplate.
Diffstat (limited to 'ipc/examples')
-rw-r--r-- | ipc/examples/gpg-agent-decrypt.rs | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/ipc/examples/gpg-agent-decrypt.rs b/ipc/examples/gpg-agent-decrypt.rs index 0f824d60..e76028ec 100644 --- a/ipc/examples/gpg-agent-decrypt.rs +++ b/ipc/examples/gpg-agent-decrypt.rs @@ -74,15 +74,11 @@ impl<'a> Helper<'a> { // Map (sub)KeyIDs to secrets. let mut keys = HashMap::new(); for cert in certs { - for ka in cert.keys().policy(None) { - if ka.binding_signature(None) - .map(|s| (s.key_flags().for_storage_encryption() - || s.key_flags().for_transport_encryption())) - .unwrap_or(false) - { - let key = ka.key(); - keys.insert(key.keyid(), key.clone().into()); - } + for ka in cert.keys().policy(None) + .for_storage_encryption().for_transport_encryption() + { + let key = ka.key(); + keys.insert(key.keyid(), key.clone().into()); } } |