diff options
| author | 2025-10-26 15:21:02 +0000 | |
|---|---|---|
| committer | 2025-10-26 15:24:15 +0000 | |
| commit | 455fd9be2edab7809d0762b0f0cf3c77454efc14 (patch) | |
| tree | 6b5adc7fbe6cc06df71752a569fea987d36d8a8c /include/modules | |
| parent | Merge branch 'insp4' into master. (diff) | |
| parent | Fix a typo in a previous commit's deprecation message. (diff) | |
Merge branch 'insp4' into master.
Diffstat (limited to 'include/modules')
| -rw-r--r-- | include/modules/ssl.h | 40 |
1 files changed, 2 insertions, 38 deletions
diff --git a/include/modules/ssl.h b/include/modules/ssl.h index 3d4b459c1..c4b8432fc 100644 --- a/include/modules/ssl.h +++ b/include/modules/ssl.h @@ -278,42 +278,6 @@ public: bool IsHookReady() const override { return status == STATUS_OPEN; } }; -/** Helper functions for obtaining TLS client certificates and key fingerprints - * from StreamSockets - */ -class SSLClientCert final -{ -public: - /** - * Get the client certificate from a socket - * @param sock The socket to get the certificate from, the socket does not have to use TLS - * @return The TLS client certificate information, NULL if the peer is not using TLS - */ - static ssl_cert* GetCertificate(StreamSocket* sock) - { - SSLIOHook* ssliohook = SSLIOHook::IsSSL(sock); - if (!ssliohook) - return nullptr; - - return ssliohook->GetCertificate(); - } - - /** - * Get the fingerprint of a client certificate from a socket - * @param sock The socket to get the certificate fingerprint from, the - * socket does not have to use TLS - * @return The key fingerprint from the TLS certificate sent by the peer, - * empty if no cert was sent or the peer is not using TLS - */ - static std::string GetFingerprint(StreamSocket* sock) - { - ssl_cert* cert = SSLClientCert::GetCertificate(sock); - if (cert) - return cert->GetFingerprint(); - return ""; - } -}; - class UserCertificateAPIBase : public DataProvider { @@ -348,7 +312,7 @@ public: std::string GetFingerprint(User* user) { ssl_cert* cert = GetCertificate(user); - if (cert) + if (cert && cert->IsUsable()) return cert->GetFingerprint(); return ""; } @@ -361,7 +325,7 @@ public: std::vector<std::string> GetFingerprints(User* user) { ssl_cert* cert = GetCertificate(user); - if (cert) + if (cert && cert->IsUsable()) return cert->GetFingerprints(); return {}; } |
