diff options
author | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-09-03 18:57:16 +0000 |
---|---|---|
committer | brain <brain@e03df62e-2008-0410-955e-edbf42e46eb7> | 2006-09-03 18:57:16 +0000 |
commit | d4af574074d05cb5705cd261c8fb97f52290e56a (patch) | |
tree | e8ac3a0aa8f85c6b2538a836d7d142e32ed29817 /src/modules/extra/m_ssl_gnutls.cpp | |
parent | 5ec6f8616938a7e2bdf906b43a5bf3f976ace016 (diff) |
We now have a test module that can dump someones certificate information: /sslinfo <nick>
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5125 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/extra/m_ssl_gnutls.cpp')
-rw-r--r-- | src/modules/extra/m_ssl_gnutls.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/modules/extra/m_ssl_gnutls.cpp b/src/modules/extra/m_ssl_gnutls.cpp index df14bbed1..0e70082e3 100644 --- a/src/modules/extra/m_ssl_gnutls.cpp +++ b/src/modules/extra/m_ssl_gnutls.cpp @@ -619,6 +619,8 @@ class ModuleSSLGnuTLS : public Module unsigned int cert_list_size, name_size; gnutls_x509_crt_t cert; char name[MAXBUF]; + unsigned char digest[MAXBUF]; + size_t digest_size = sizeof(digest); ssl_cert* certinfo = new ssl_cert; user->Extend("ssl_cert",certinfo); @@ -713,6 +715,15 @@ class ModuleSSLGnuTLS : public Module certinfo->data.insert(std::make_pair("issuer",name)); + if ((ret = gnutls_x509_crt_get_fingerprint(cert, GNUTLS_DIG_MD5, digest, &digest_size)) < 0) + { + certinfo->data.insert(std::make_pair("error",gnutls_strerror(ret))); + } + else + { + certinfo->data.insert(std::make_pair("fingerprint",irc::hex(digest, digest_size))); + } + /* Beware here we do not check for errors. */ if ((gnutls_x509_crt_get_expiration_time(cert) < time(0)) || (gnutls_x509_crt_get_activation_time(cert) > time(0))) |