summaryrefslogtreecommitdiffstats
path: root/src/libcryptobox/keypair.h
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2018-06-09 12:41:28 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2018-06-09 12:41:28 +0100
commitc1e80bdef0fdce05631cdc6a697d9832895b3d5a (patch)
tree5598524cf7a14e467aab9b126ec97143a44943c1 /src/libcryptobox/keypair.h
parent85e5de3d81b8bf6ef7bf4592ff77d56cd59191c6 (diff)
downloadrspamd-c1e80bdef0fdce05631cdc6a697d9832895b3d5a.tar.gz
rspamd-c1e80bdef0fdce05631cdc6a697d9832895b3d5a.zip
[Minor] Add ability to encrypt data using pubkey only
Diffstat (limited to 'src/libcryptobox/keypair.h')
-rw-r--r--src/libcryptobox/keypair.h17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/libcryptobox/keypair.h b/src/libcryptobox/keypair.h
index 3e78e7cbb..d7c386b91 100644
--- a/src/libcryptobox/keypair.h
+++ b/src/libcryptobox/keypair.h
@@ -303,6 +303,21 @@ gboolean rspamd_keypair_encrypt (struct rspamd_cryptobox_keypair *kp,
const guchar *in, gsize inlen,
guchar **out, gsize *outlen,
GError **err);
-
+/**
+ * Encrypts data usign specific pubkey (must have KEX type).
+ * This method actually generates ephemeral local keypair, use public key from
+ * the remote keypair and encrypts data
+ * @param kp keypair
+ * @param in raw input
+ * @param inlen input length
+ * @param out output (allocated internally using g_malloc)
+ * @param outlen output size
+ * @param err pointer to error
+ * @return TRUE if encryption has been completed, out must be freed in this case
+ */
+gboolean rspamd_pubkey_encrypt (struct rspamd_cryptobox_pubkey *pk,
+ const guchar *in, gsize inlen,
+ guchar **out, gsize *outlen,
+ GError **err);
#endif /* SRC_LIBCRYPTOBOX_KEYPAIR_H_ */