summaryrefslogtreecommitdiffstats
path: root/src/sequoia.h
diff options
context:
space:
mode:
authorJustus Winter <justus@pep-project.org>2017-12-06 18:21:01 +0100
committerJustus Winter <justus@pep-project.org>2017-12-12 12:48:05 +0100
commitc1082dbc8461a27fe7e8967084a3f072a2880ed1 (patch)
tree7c5a6894aebf68c20fc7ecd24d19172a520032f5 /src/sequoia.h
parent6f6a2e8fc95b7506f769f122b4b3e5982a52336c (diff)
Retrieve and send keys using the hkps? protocol.
- Use hyper for http, hyper-tls for https. - Provide an easy constructor for the hkps pool. - Add ffi glue.
Diffstat (limited to 'src/sequoia.h')
-rw-r--r--src/sequoia.h57
1 files changed, 57 insertions, 0 deletions
diff --git a/src/sequoia.h b/src/sequoia.h
index 1b7015b5..4755658a 100644
--- a/src/sequoia.h
+++ b/src/sequoia.h
@@ -93,4 +93,61 @@ struct sq_tpk *sq_tpk_from_bytes (const char *b, size_t len);
void sq_tpk_dump (const struct sq_tpk *tpk);
void sq_tpk_free (struct sq_tpk *tpk);
+
+/* sequoia::net. */
+
+/*/
+/// For accessing keyservers using HKP.
+/*/
+struct sq_keyserver;
+
+/*/
+/// Returns a handle for the given URI.
+///
+/// `uri` is a UTF-8 encoded value of a keyserver URI,
+/// e.g. `hkps://examle.org`.
+///
+/// Returns `NULL` on errors.
+/*/
+struct sq_keyserver *sq_keyserver_new (const struct sq_context *ctx,
+ const char *uri);
+
+/*/
+/// Returns a handle for the given URI.
+///
+/// `uri` is a UTF-8 encoded value of a keyserver URI,
+/// e.g. `hkps://examle.org`. `cert` is a DER encoded certificate of
+/// size `len` used to authenticate the server.
+///
+/// Returns `NULL` on errors.
+/*/
+struct sq_keyserver *sq_keyserver_with_cert (const struct sq_context *ctx,
+ const char *uri,
+ const uint8_t *cert,
+ size_t len);
+
+/*/
+/// Returns a handle for the SKS keyserver pool.
+///
+/// The pool `hkps://hkps.pool.sks-keyservers.net` provides HKP
+/// services over https. It is authenticated using a certificate
+/// included in this library. It is a good default choice.
+///
+/// Returns `NULL` on errors.
+/*/
+struct sq_keyserver *sq_keyserver_sks_pool (const struct sq_context *ctx);
+
+/*/
+/// Frees a keyserver object.
+/*/
+void sq_keyserver_free (struct sq_keyserver *ks);
+
+/*/
+/// Retrieves the key with the given `keyid`.
+///
+/// Returns `NULL` on errors.
+/*/
+struct sq_tpk *sq_keyserver_get (struct sq_keyserver *ks,
+ const struct sq_keyid *id);
+
#endif