if (sess)
{
std::string text = "*** You are connected using SSL cipher '";
-
- text += UnknownIfNULL(gnutls_kx_get_name(gnutls_kx_get(sess)));
- text.append("-").append(UnknownIfNULL(gnutls_cipher_get_name(gnutls_cipher_get(sess)))).append("-");
- text.append(UnknownIfNULL(gnutls_mac_get_name(gnutls_mac_get(sess)))).append("'");
-
+ GetCiphersuite(text);
+ text += '\'';
if (!certificate->fingerprint.empty())
text += " and your SSL certificate fingerprint is " + certificate->fingerprint;
}
}
+ void GetCiphersuite(std::string& out) const
+ {
+ out.append(UnknownIfNULL(gnutls_kx_get_name(gnutls_kx_get(sess)))).push_back('-');
+ out.append(UnknownIfNULL(gnutls_cipher_get_name(gnutls_cipher_get(sess)))).push_back('-');
+ out.append(UnknownIfNULL(gnutls_mac_get_name(gnutls_mac_get(sess))));
+ }
+
GnuTLS::Profile* GetProfile() { return profile; }
};
{
if (sess)
{
- std::string text = "*** You are connected using SSL cipher '" + std::string(SSL_get_cipher(sess)) + "'";
+ std::string text = "*** You are connected using SSL cipher '";
+ GetCiphersuite(text);
+ text += '\'';
const std::string& fingerprint = certificate->fingerprint;
if (!fingerprint.empty())
text += " and your SSL certificate fingerprint is " + fingerprint;
user->WriteNotice(text);
}
}
+
+ void GetCiphersuite(std::string& out) const
+ {
+ out.append(SSL_get_cipher(sess));
+ }
};
static void StaticSSLInfoCallback(const SSL* ssl, int where, int rc)