summaryrefslogtreecommitdiffstats
path: root/openpgp-ffi/examples
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@pep.foundation>2020-03-20 16:38:27 +0100
committerNeal H. Walfield <neal@pep.foundation>2020-03-20 19:03:15 +0100
commitff1f37a7b86780ef8d533b66f6aaea9a0f393956 (patch)
tree3a69884f8f6327c683360bc4df551d009290f10e /openpgp-ffi/examples
parent1909b1f0a9fe60b588f31155bdfaa5ffbec3e22e (diff)
openpgp-ffi: Change key iterator to return key amalgamations.
- Introduce `KeyAmalgamation` and `ValidKeyAmalgamation` to the C FFI. - Change pgp_cert_key_iter_next and pgp_cert_valid_key_iter_next to return them instead of keys.
Diffstat (limited to 'openpgp-ffi/examples')
-rw-r--r--openpgp-ffi/examples/decrypt-with.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/openpgp-ffi/examples/decrypt-with.c b/openpgp-ffi/examples/decrypt-with.c
index 489e70aa..b6fff7b1 100644
--- a/openpgp-ffi/examples/decrypt-with.c
+++ b/openpgp-ffi/examples/decrypt-with.c
@@ -170,14 +170,17 @@ decrypt_cb (void *cookie_opaque,
pgp_keyid_t keyid = pgp_pkesk_recipient (pkesk);
pgp_cert_key_iter_t key_iter = pgp_cert_key_iter (cookie->key);
+ pgp_key_amalgamation_t ka;
pgp_key_t key;
- while ((key = pgp_cert_key_iter_next (key_iter))) {
+ while ((ka = pgp_cert_key_iter_next (key_iter))) {
+ key = pgp_key_amalgamation_key (ka);
pgp_keyid_t this_keyid = pgp_key_keyid (key);
int match = pgp_keyid_equal (this_keyid, keyid);
pgp_keyid_free (this_keyid);
if (match)
break;
pgp_key_free (key);
+ pgp_key_amalgamation_free (ka);
}
pgp_cert_key_iter_free (key_iter);
pgp_keyid_free (keyid);
@@ -193,6 +196,7 @@ decrypt_cb (void *cookie_opaque,
error (1, 0, "pgp_pkesk_decrypt: %s", pgp_error_to_string (err));
}
pgp_key_free (key);
+ pgp_key_amalgamation_free (ka);
pgp_session_key_t sk = pgp_session_key_from_bytes (session_key,
session_key_len);