KIO

ksslerroruidata.cpp
1 /*
2  This file is part of the KDE libraries
3  SPDX-FileCopyrightText: 2007, 2008 Andreas Hartmetz <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7 
8 #include "ksslerroruidata.h"
9 #include "ksslerroruidata_p.h"
10 #include "ktcpsocket.h"
11 
12 #include <QHostAddress>
13 #include <QNetworkReply>
14 #include <QSslCipher>
15 
17  : d(new Private())
18 {
19  d->usedBits = 0;
20  d->bits = 0;
21 }
22 
23 #if KIOCORE_BUILD_DEPRECATED_SINCE(5, 65)
25  : d(new Private())
26 {
27  d->certificateChain = socket->peerCertificateChain();
28  const auto ksslErrors = socket->sslErrors();
29  d->sslErrors.reserve(ksslErrors.size());
30  for (const auto &error : ksslErrors) {
31  d->sslErrors.push_back(error.sslError());
32  }
33  d->ip = socket->peerAddress().toString();
34  d->host = socket->peerName();
35  d->sslProtocol = socket->negotiatedSslVersionName();
36  d->cipher = socket->sessionCipher().name();
37  d->usedBits = socket->sessionCipher().usedBits();
38  d->bits = socket->sessionCipher().supportedBits();
39 }
40 #endif
41 
43  : d(new Private())
44 {
45  d->certificateChain = socket->peerCertificateChain();
46 #if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0))
47  d->sslErrors = socket->sslErrors();
48 #else
49  d->sslErrors = socket->sslHandshakeErrors();
50 #endif
51  d->ip = socket->peerAddress().toString();
52  d->host = socket->peerName();
53  if (socket->isEncrypted()) {
54  d->sslProtocol = socket->sessionCipher().protocolString();
55  }
56  d->cipher = socket->sessionCipher().name();
57  d->usedBits = socket->sessionCipher().usedBits();
58  d->bits = socket->sessionCipher().supportedBits();
59 }
60 
62  : d(new Private())
63 {
64  const auto sslConfig = reply->sslConfiguration();
65  d->certificateChain = sslConfig.peerCertificateChain();
66  d->sslErrors = sslErrors;
67  d->host = reply->request().url().host();
68  d->sslProtocol = sslConfig.sessionCipher().protocolString();
69  d->cipher = sslConfig.sessionCipher().name();
70  d->usedBits = sslConfig.sessionCipher().usedBits();
71  d->bits = sslConfig.sessionCipher().supportedBits();
72 }
73 
75  : d(new Private(*other.d))
76 {}
77 
79 {
80  delete d;
81 }
82 
83 KSslErrorUiData &KSslErrorUiData::operator=(const KSslErrorUiData &other)
84 {
85  *d = *other.d;
86  return *this;
87 }
88 
QHostAddress peerAddress() const const
KSslErrorUiData()
Default construct an instance with no useful data.
int supportedBits() const const
QString host(QUrl::ComponentFormattingOptions options) const const
QNetworkRequest request() const const
QString toString() const const
TCP socket.
Definition: ktcpsocket.h:155
bool isEncrypted() const const
QSslCipher sessionCipher() const const
QList< QSslCertificate > peerCertificateChain() const const
This class can hold all the necessary data from a KTcpSocket to ask the user to continue connecting i...
QUrl url() const const
QString protocolString() const const
QSslConfiguration sslConfiguration() const const
~KSslErrorUiData()
Destructor.
QString peerName() const const
QString name() const const
QList< QSslError > sslErrors() const const
QList< QSslError > sslHandshakeErrors() const const
int usedBits() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Tue Sep 29 2020 23:08:34 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.