From b28143aec8a66798a80ea77bc5838dd558468a99 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Diego=20=27Flameeyes=27=20Petten=C3=B2?= Date: Mon, 16 Jun 2008 19:56:13 +0200 Subject: [PATCH] Allow user to provide a key/certificate pair for outgoing IRC connections. OFTC supports a way to identify clients based on the fingerprint of the SSL certificated used to initialise the connection. This patch allows to make use of the CertFP identification by creating a ~/.quassel/quasselClientCert.pem key/certificate file, which will be used for all the outgoing SSL connections to IRC servers. At the moment the message sent by the server at the connection is not displayed by quassel, so you'll have to find the certificate's fingerprint through OpenSSL (or any other method). Signed-off-by: Manuel Nickschas --- src/core/networkconnection.cpp | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/core/networkconnection.cpp b/src/core/networkconnection.cpp index 97c573a8..02bd2592 100644 --- a/src/core/networkconnection.cpp +++ b/src/core/networkconnection.cpp @@ -86,6 +86,23 @@ NetworkConnection::NetworkConnection(Network *network, CoreSession *session) connect(network, SIGNAL(autoReconnectRetriesSet(quint16)), this, SLOT(autoReconnectSettingsChanged())); #ifndef QT_NO_OPENSSL + { + QFile certFile(quasselDir().absolutePath() + "/quasselClientCert.pem"); + certFile.open(QIODevice::ReadOnly); + QSslCertificate cert(&certFile); + certFile.close(); + + certFile.open(QIODevice::ReadOnly); + QSslKey key(&certFile, QSsl::Rsa); + certFile.close(); + + if ( !cert.isNull() && cert.isValid() && + !key.isNull() ) { + socket.setLocalCertificate(cert); + socket.setPrivateKey(key); + } + } + connect(&socket, SIGNAL(encrypted()), this, SLOT(socketEncrypted())); connect(&socket, SIGNAL(sslErrors(const QList &)), this, SLOT(sslErrors(const QList &))); #endif -- 2.20.1