summaryrefslogtreecommitdiffstats
path: root/openpgp/examples
diff options
context:
space:
mode:
Diffstat (limited to 'openpgp/examples')
-rw-r--r--openpgp/examples/decrypt-with.rs18
1 files changed, 7 insertions, 11 deletions
diff --git a/openpgp/examples/decrypt-with.rs b/openpgp/examples/decrypt-with.rs
index b3feceb6..c28dbe1c 100644
--- a/openpgp/examples/decrypt-with.rs
+++ b/openpgp/examples/decrypt-with.rs
@@ -58,18 +58,14 @@ impl Helper {
// 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)
+ for ka in cert.keys().policy(None)
+ .for_storage_encryption().for_transport_encryption()
+ {
+ // This only works for unencrypted secret keys.
+ if let Ok(keypair) =
+ ka.key().clone().mark_parts_secret().unwrap().into_keypair()
{
- // This only works for unencrypted secret keys.
- if let Ok(keypair) =
- ka.key().clone().mark_parts_secret().unwrap().into_keypair()
- {
- keys.insert(ka.key().keyid(), keypair);
- }
+ keys.insert(ka.key().keyid(), keypair);
}
}
}