X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=include%2Fmodules%2Fssl.h;h=9cc504128daae20a0daee6b4ea0c2880d8ccaa67;hb=7770cd985405c7630e9149fc08c314ec824a9c75;hp=67bfc7b2ec30efea403e9888e333b01110aea24a;hpb=0b63ccd0b5cb26883d6becb196fb98e4f95d0397;p=user%2Fhenk%2Fcode%2Finspircd.git 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(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(iohook); return ssliohook->GetCertificate(); }