summaryrefslogtreecommitdiff
path: root/include/modules/ssl.h
diff options
context:
space:
mode:
authorAttila Molnar <attilamolnar@hush.com>2016-04-30 16:54:37 +0200
committerAttila Molnar <attilamolnar@hush.com>2016-04-30 16:54:37 +0200
commitfb66fb5ce3410d7e32813aed85e8ad3050584740 (patch)
treea36d649156325dbd76f314eaac6c14f724d56b04 /include/modules/ssl.h
parent6cfe4011ec0e90718d7d5a449a5330b8e9a18ec3 (diff)
parent1e4b53a286e428e78bd5650815048970d345f7e3 (diff)
Merge branch 'master+sslconnmsg'
Diffstat (limited to 'include/modules/ssl.h')
-rw-r--r--include/modules/ssl.h19
1 files changed, 16 insertions, 3 deletions
diff --git a/include/modules/ssl.h b/include/modules/ssl.h
index 67bfc7b2e..9cc504128 100644
--- a/include/modules/ssl.h
+++ b/include/modules/ssl.h
@@ -164,6 +164,14 @@ class SSLIOHook : public IOHook
}
public:
+ static SSLIOHook* IsSSL(StreamSocket* sock)
+ {
+ IOHook* const iohook = sock->GetIOHook();
+ if ((iohook) && ((iohook->prov->type == IOHookProvider::IOH_SSL)))
+ return static_cast<SSLIOHook*>(iohook);
+ return NULL;
+ }
+
SSLIOHook(IOHookProvider* hookprov)
: IOHook(hookprov)
{
@@ -190,6 +198,12 @@ class SSLIOHook : public IOHook
return cert->GetFingerprint();
return "";
}
+
+ /**
+ * Get the ciphersuite negotiated with the peer
+ * @param out String where the ciphersuite string will be appended to
+ */
+ virtual void GetCiphersuite(std::string& out) const = 0;
};
/** Helper functions for obtaining SSL client certificates and key fingerprints
@@ -205,11 +219,10 @@ class SSLClientCert
*/
static ssl_cert* GetCertificate(StreamSocket* sock)
{
- IOHook* iohook = sock->GetIOHook();
- if ((!iohook) || (iohook->prov->type != IOHookProvider::IOH_SSL))
+ SSLIOHook* ssliohook = SSLIOHook::IsSSL(sock);
+ if (!ssliohook)
return NULL;
- SSLIOHook* ssliohook = static_cast<SSLIOHook*>(iohook);
return ssliohook->GetCertificate();
}