diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-06-11 18:29:42 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2018-06-11 18:29:42 +0100 |
commit | 86ab98690846566a9efafe3d39c2f194f87a238d (patch) | |
tree | 0e218e7d5571393d3eaff99dd9eababd31425306 /src/libserver/dkim.h | |
parent | 1aef6bbce250d14411702b0104975db1bd454167 (diff) | |
download | rspamd-86ab98690846566a9efafe3d39c2f194f87a238d.tar.gz rspamd-86ab98690846566a9efafe3d39c2f194f87a238d.zip |
[Minor] Add some public methods to DKIM API
Diffstat (limited to 'src/libserver/dkim.h')
-rw-r--r-- | src/libserver/dkim.h | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/libserver/dkim.h b/src/libserver/dkim.h index 2a8b0e0b5..5081c0f52 100644 --- a/src/libserver/dkim.h +++ b/src/libserver/dkim.h @@ -120,6 +120,24 @@ enum rspamd_dkim_type { RSPAMD_DKIM_ARC_SEAL }; +/* Signature methods */ +enum rspamd_sign_type { + DKIM_SIGN_UNKNOWN = -2, + DKIM_SIGN_RSASHA1 = 0, + DKIM_SIGN_RSASHA256, + DKIM_SIGN_RSASHA512, + DKIM_SIGN_ECDSASHA256, + DKIM_SIGN_ECDSASHA512, + DKIM_SIGN_EDDSASHA256, +}; + +enum rspamd_dkim_key_type { + RSPAMD_DKIM_KEY_RSA = 0, + RSPAMD_DKIM_KEY_ECDSA, + RSPAMD_DKIM_KEY_EDDSA +}; + + /* Err MUST be freed if it is not NULL, key is allocated by slice allocator */ typedef void (*dkim_key_handler_f)(rspamd_dkim_key_t *key, gsize keylen, rspamd_dkim_context_t *ctx, gpointer ud, GError *err); @@ -208,6 +226,28 @@ const gchar* rspamd_dkim_get_dns_key (rspamd_dkim_context_t *ctx); guint rspamd_dkim_key_get_ttl (rspamd_dkim_key_t *k); /** + * Create DKIM public key from a raw data + * @param keydata + * @param keylen + * @param type + * @param err + * @return + */ +rspamd_dkim_key_t * rspamd_dkim_make_key (const gchar *keydata, guint keylen, + enum rspamd_dkim_key_type type, + GError **err); + +/** + * Parse DKIM public key from a TXT record + * @param txt + * @param keylen + * @param err + * @return + */ +rspamd_dkim_key_t * rspamd_dkim_parse_key (const gchar *txt, gsize *keylen, + GError **err); + +/** * Canonocalise header using relaxed algorithm * @param hname * @param hvalue |