aboutsummaryrefslogtreecommitdiffstats
path: root/src/libcryptobox/keypair.h
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2016-02-06 01:29:49 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2016-02-06 01:29:49 +0000
commitc1b90ddc7dd856671c9585368b2f34b4548ca690 (patch)
tree886efe8eb29a143a4897cfc01cad8e0c25bf5921 /src/libcryptobox/keypair.h
parent153c267b22c3a4c0a40b36f14d7303727a53f95b (diff)
downloadrspamd-c1b90ddc7dd856671c9585368b2f34b4548ca690.tar.gz
rspamd-c1b90ddc7dd856671c9585368b2f34b4548ca690.zip
Add more methods to keypair management
Diffstat (limited to 'src/libcryptobox/keypair.h')
-rw-r--r--src/libcryptobox/keypair.h27
1 files changed, 27 insertions, 0 deletions
diff --git a/src/libcryptobox/keypair.h b/src/libcryptobox/keypair.h
index 613c1296d..697e06a3d 100644
--- a/src/libcryptobox/keypair.h
+++ b/src/libcryptobox/keypair.h
@@ -93,6 +93,18 @@ struct rspamd_cryptobox_pubkey* rspamd_pubkey_from_hex (const gchar *hex,
enum rspamd_cryptobox_keypair_type type,
enum rspamd_cryptobox_mode alg);
+/**
+ * Load pubkey from raw chunk string
+ * @param hex input data
+ * @param type type of key (signing or kex)
+ * @param alg algorithm of the key (nist or curve25519)
+ * @return new pubkey or NULL in case of error
+ */
+struct rspamd_cryptobox_pubkey* rspamd_pubkey_from_bin (const guchar *raw,
+ gsize len,
+ enum rspamd_cryptobox_keypair_type type,
+ enum rspamd_cryptobox_mode alg);
+
/**
* Decrease refcount for the specific pubkey (or destroy when refcount == 0)
@@ -195,4 +207,19 @@ GString *rspamd_keypair_print (struct rspamd_cryptobox_keypair *kp,
const guchar * rspamd_keypair_component (struct rspamd_cryptobox_keypair *kp,
guint ncomp, guint *len);
+/**
+ * Create a new keypair from ucl object
+ * @param obj object to load
+ * @return new structure or NULL if an object is invalid
+ */
+struct rspamd_cryptobox_keypair * rspamd_keypair_from_ucl (const ucl_object_t *obj);
+
+/**
+ * Converts keypair to ucl object
+ * @param kp
+ * @return
+ */
+ucl_object_t * rspamd_keypair_to_ucl (struct rspamd_cryptobox_keypair *kp,
+ gboolean is_hex);
+
#endif /* SRC_LIBCRYPTOBOX_KEYPAIR_H_ */