summaryrefslogtreecommitdiffstats
path: root/openpgp-ffi/include/sequoia/openpgp/serialize.h
diff options
context:
space:
mode:
authorJustus Winter <justus@sequoia-pgp.org>2019-09-06 13:47:50 +0200
committerJustus Winter <justus@sequoia-pgp.org>2019-09-06 16:42:12 +0200
commit38a4d2b4ff4fc4512b31a4ff4e4ddd8a6b3c7503 (patch)
tree469d667b6bab8333df02c7a2402b9edabbe08419 /openpgp-ffi/include/sequoia/openpgp/serialize.h
parent4d642187f1df0c9a4c60dc2355c797ebac6fcd4f (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 'openpgp-ffi/include/sequoia/openpgp/serialize.h')
-rw-r--r--openpgp-ffi/include/sequoia/openpgp/serialize.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/openpgp-ffi/include/sequoia/openpgp/serialize.h b/openpgp-ffi/include/sequoia/openpgp/serialize.h
new file mode 100644
index 00000000..7d41d9b0
--- /dev/null
+++ b/openpgp-ffi/include/sequoia/openpgp/serialize.h
@@ -0,0 +1,40 @@
+#ifndef SEQUOIA_OPENPGP_SERIALIZE_H
+#define SEQUOIA_OPENPGP_SERIALIZE_H
+
+/*/
+/// Creates a new recipient with an explicit recipient keyid.
+///
+/// Consumes `keyid`, references `key`.
+/*/
+pgp_recipient_t pgp_recipient_new (pgp_keyid_t keyid, pgp_key_t key);
+
+/*/
+/// Frees this object.
+/*/
+void pgp_recipient_free (pgp_recipient_t);
+
+/*/
+/// Returns a human readable description of this object suitable for
+/// debugging.
+/*/
+char *pgp_recipient_debug (const pgp_recipient_t);
+
+/*/
+/// Gets the KeyID.
+/*/
+pgp_keyid_t pgp_recipient_keyid (const pgp_recipient_t);
+
+/*/
+/// Sets the KeyID.
+/*/
+void pgp_recipient_set_keyid (pgp_recipient_t, pgp_keyid_t);
+
+/*/
+/// Collects recipients from a `pgp_tpk_key_iter_t`.
+///
+/// Consumes the iterator. The returned buffer must be freed using
+/// libc's allocator.
+/*/
+pgp_recipient_t *pgp_recipients_from_key_iter (pgp_tpk_key_iter_t, size_t *);
+
+#endif