diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2019-09-06 13:47:50 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2019-09-06 16:42:12 +0200 |
commit | 38a4d2b4ff4fc4512b31a4ff4e4ddd8a6b3c7503 (patch) | |
tree | 469d667b6bab8333df02c7a2402b9edabbe08419 /ipc | |
parent | 4d642187f1df0c9a4c60dc2355c797ebac6fcd4f (diff) |
openpgp: Rework streaming encryptor.
- Instead of giving a set of TPKs to the encryptor, hand in a set of
recipients, which are (keyid, key)-tuples, conveniently created
from key queries over TPKs. This simplifies the encryptor, and
makes the key selection explicit.
- Drop the EncryptionMode type.
- As a nice side effect, we can now generate encrypted messages with
wildcard recipient addresses.
Diffstat (limited to 'ipc')
-rw-r--r-- | ipc/tests/gpg-agent.rs | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/ipc/tests/gpg-agent.rs b/ipc/tests/gpg-agent.rs index ea07a4e1..707f2bb6 100644 --- a/ipc/tests/gpg-agent.rs +++ b/ipc/tests/gpg-agent.rs @@ -200,14 +200,20 @@ fn decrypt() { let mut message = Vec::new(); { + // Build a vector of recipients to hand to Encryptor. + let recipients = + tpk.keys_valid().key_flags( + KeyFlags::default().set_encrypt_for_transport(true)) + .map(|(_, _, key)| key.into()) + .collect::<Vec<Recipient>>(); + // Start streaming an OpenPGP message. let message = Message::new(&mut message); // We want to encrypt a literal data packet. let encryptor = Encryptor::new(message, &[], // No symmetric encryption. - &[&tpk], - EncryptionMode::ForTransport, + recipients, None, None).unwrap(); // Emit a literal data packet. |