diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-05-23 10:09:06 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-05-23 10:09:06 +0100 |
commit | a2de3547f790b500c8557502db1e79485307945a (patch) | |
tree | cb5e0417d4c70f87862a35f5d2bf086ab58ce4fd /src/libutil | |
parent | 52420396f67209a08372ccf3e472aa3f2a24441b (diff) | |
download | rspamd-a2de3547f790b500c8557502db1e79485307945a.tar.gz rspamd-a2de3547f790b500c8557502db1e79485307945a.zip |
[Feature] Add routines to compare and check pubkeys
Diffstat (limited to 'src/libutil')
-rw-r--r-- | src/libutil/http.c | 15 | ||||
-rw-r--r-- | src/libutil/http.h | 8 |
2 files changed, 23 insertions, 0 deletions
diff --git a/src/libutil/http.c b/src/libutil/http.c index fef9cb73c..0e0f30eaf 100644 --- a/src/libutil/http.c +++ b/src/libutil/http.c @@ -2391,6 +2391,21 @@ rspamd_http_connection_set_key (struct rspamd_http_connection *conn, priv->local_key = rspamd_keypair_ref (key); } +const struct rspamd_cryptobox_pubkey* +rspamd_http_connection_get_peer_key (struct rspamd_http_connection *conn) +{ + struct rspamd_http_connection_private *priv = conn->priv; + + if (priv->peer_key) { + return priv->peer_key; + } + else if (priv->msg) { + return priv->msg->peer_key; + } + + return NULL; +} + gboolean rspamd_http_connection_is_encrypted (struct rspamd_http_connection *conn) { diff --git a/src/libutil/http.h b/src/libutil/http.h index 9793e577b..d9fb73b82 100644 --- a/src/libutil/http.h +++ b/src/libutil/http.h @@ -166,6 +166,14 @@ void rspamd_http_connection_set_key (struct rspamd_http_connection *conn, struct rspamd_cryptobox_keypair *key); /** + * Get peer's public key + * @param conn connection structure + * @return pubkey structure or NULL + */ +const struct rspamd_cryptobox_pubkey* rspamd_http_connection_get_peer_key ( + struct rspamd_http_connection *conn); + +/** * Returns TRUE if a connection is encrypted * @param conn * @return |