diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-05-19 14:50:43 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-05-19 14:50:43 +0100 |
commit | 3fc31cc8724885d8d0f2d7ff8028f3b4f6b49c8e (patch) | |
tree | c0ce728b942f020b5eb033613dab2e8340dfc60d /src/libcryptobox/keypair.h | |
parent | a661d5e4c0487a6015db7d4fe3ddcf1cf3f99f5f (diff) | |
download | rspamd-3fc31cc8724885d8d0f2d7ff8028f3b4f6b49c8e.tar.gz rspamd-3fc31cc8724885d8d0f2d7ff8028f3b4f6b49c8e.zip |
[Minor] Add method to decrypt data using keypair
Diffstat (limited to 'src/libcryptobox/keypair.h')
-rw-r--r-- | src/libcryptobox/keypair.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/libcryptobox/keypair.h b/src/libcryptobox/keypair.h index b24ecc9aa..fc17412e2 100644 --- a/src/libcryptobox/keypair.h +++ b/src/libcryptobox/keypair.h @@ -28,6 +28,8 @@ enum rspamd_cryptobox_keypair_type { RSPAMD_KEYPAIR_SIGN }; +extern const guchar encrypted_magic[7]; + /** * Opaque structure for the full (public + private) keypair */ @@ -270,5 +272,20 @@ gboolean rspamd_keypair_verify (struct rspamd_cryptobox_pubkey *pk, gboolean rspamd_pubkey_equal (const struct rspamd_cryptobox_pubkey *k1, const struct rspamd_cryptobox_pubkey *k2); +/** + * Decrypts data using keypair and a pubkey stored in in, in must start from + * `encrypted_magic` constant + * @param kp keypair + * @param in raw input + * @param inlen input length + * @param out output (allocated internally using g_malloc) + * @param outlen output size + * @return TRUE if decryption is completed, out must be freed in this case + */ +gboolean rspamd_keypair_decrypt (struct rspamd_cryptobox_keypair *kp, + const guchar *in, gsize inlen, + guchar **out, gsize *outlen, + GError **err); + #endif /* SRC_LIBCRYPTOBOX_KEYPAIR_H_ */ |