diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2019-09-06 13:02:52 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2019-09-06 13:02:52 +0200 |
commit | 4d642187f1df0c9a4c60dc2355c797ebac6fcd4f (patch) | |
tree | a08e5babdf1b282c2df90a48a8287d4f3560fcc6 /openpgp | |
parent | 38f59d8384e775da91e94d2040722a3cdfad9f44 (diff) |
openpgp: New filters for encryption-capable keys.
Diffstat (limited to 'openpgp')
-rw-r--r-- | openpgp/src/tpk/keyiter.rs | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/openpgp/src/tpk/keyiter.rs b/openpgp/src/tpk/keyiter.rs index 16e51cc4..9c1635dc 100644 --- a/openpgp/src/tpk/keyiter.rs +++ b/openpgp/src/tpk/keyiter.rs @@ -274,6 +274,20 @@ impl<'a, P: 'a + key::KeyParts, R: 'a + key::KeyRole> KeyIter<'a, P, R> self.key_flags(KeyFlags::default().set_sign(true)) } + /// Returns keys that are capable of encrypting data at rest. + /// + /// See `key_flags` for caveats. + pub fn encrypting_capable_at_rest(self) -> Self { + self.key_flags(KeyFlags::default().set_encrypt_at_rest(true)) + } + + /// Returns keys that are capable of encrypting data for transport. + /// + /// See `key_flags` for caveats. + pub fn encrypting_capable_for_transport(self) -> Self { + self.key_flags(KeyFlags::default().set_encrypt_for_transport(true)) + } + /// Only returns keys that are live as of `now`. /// /// If `now` is none, then all keys are returned whether they are |