OpenCoverage

qsslconfiguration.cpp

Absolute File Name:/home/qt/qt5_coco/qt5/qtbase/src/network/ssl/qsslconfiguration.cpp
Source codeSwitch to Preprocessed file
LineSourceCount
1/****************************************************************************-
2**-
3** Copyright (C) 2016 The Qt Company Ltd.-
4** Copyright (C) 2014 BlackBerry Limited. All rights reserved.-
5** Contact: https://www.qt.io/licensing/-
6**-
7** This file is part of the QtNetwork module of the Qt Toolkit.-
8**-
9** $QT_BEGIN_LICENSE:LGPL$-
10** Commercial License Usage-
11** Licensees holding valid commercial Qt licenses may use this file in-
12** accordance with the commercial license agreement provided with the-
13** Software or, alternatively, in accordance with the terms contained in-
14** a written agreement between you and The Qt Company. For licensing terms-
15** and conditions see https://www.qt.io/terms-conditions. For further-
16** information use the contact form at https://www.qt.io/contact-us.-
17**-
18** GNU Lesser General Public License Usage-
19** Alternatively, this file may be used under the terms of the GNU Lesser-
20** General Public License version 3 as published by the Free Software-
21** Foundation and appearing in the file LICENSE.LGPL3 included in the-
22** packaging of this file. Please review the following information to-
23** ensure the GNU Lesser General Public License version 3 requirements-
24** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.-
25**-
26** GNU General Public License Usage-
27** Alternatively, this file may be used under the terms of the GNU-
28** General Public License version 2.0 or (at your option) the GNU General-
29** Public license version 3 or any later version approved by the KDE Free-
30** Qt Foundation. The licenses are as published by the Free Software-
31** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3-
32** included in the packaging of this file. Please review the following-
33** information to ensure the GNU General Public License requirements will-
34** be met: https://www.gnu.org/licenses/gpl-2.0.html and-
35** https://www.gnu.org/licenses/gpl-3.0.html.-
36**-
37** $QT_END_LICENSE$-
38**-
39****************************************************************************/-
40-
41#include "qssl_p.h"-
42#include "qsslconfiguration.h"-
43#include "qsslconfiguration_p.h"-
44#include "qsslsocket.h"-
45#include "qsslsocket_p.h"-
46#include "qmutex.h"-
47#include "qdebug.h"-
48-
49QT_BEGIN_NAMESPACE-
50-
51const QSsl::SslOptions QSslConfigurationPrivate::defaultSslOptions = QSsl::SslOptionDisableEmptyFragments-
52 |QSsl::SslOptionDisableLegacyRenegotiation-
53 |QSsl::SslOptionDisableCompression-
54 |QSsl::SslOptionDisableSessionPersistence;-
55-
56const char QSslConfiguration::NextProtocolSpdy3_0[] = "spdy/3";-
57const char QSslConfiguration::NextProtocolHttp1_1[] = "http/1.1";-
58-
59/*!-
60 \class QSslConfiguration-
61 \brief The QSslConfiguration class holds the configuration and state of an SSL connection-
62 \since 4.4-
63-
64 \reentrant-
65 \inmodule QtNetwork-
66 \ingroup network-
67 \ingroup ssl-
68 \ingroup shared-
69-
70 QSslConfiguration is used by Qt networking classes to relay-
71 information about an open SSL connection and to allow the-
72 application to control certain features of that connection.-
73-
74 The settings that QSslConfiguration currently supports are:-
75-
76 \list-
77 \li The SSL/TLS protocol to be used-
78 \li The certificate to be presented to the peer during connection-
79 and its associated private key-
80 \li The ciphers allowed to be used for encrypting the connection-
81 \li The list of Certificate Authorities certificates that are-
82 used to validate the peer's certificate-
83 \endlist-
84-
85 These settings are applied only during the connection-
86 handshake. Setting them after the connection has been established-
87 has no effect.-
88-
89 The state that QSslConfiguration supports are:-
90 \list-
91 \li The certificate the peer presented during handshake, along-
92 with the chain leading to a CA certificate-
93 \li The cipher used to encrypt this session-
94 \endlist-
95-
96 The state can only be obtained once the SSL connection starts, but-
97 not necessarily before it's done. Some settings may change during-
98 the course of the SSL connection without need to restart it (for-
99 instance, the cipher can be changed over time).-
100-
101 State in QSslConfiguration objects cannot be changed.-
102-
103 QSslConfiguration can be used with QSslSocket and the Network-
104 Access API.-
105-
106 Note that changing settings in QSslConfiguration is not enough to-
107 change the settings in the related SSL connection. You must call-
108 setSslConfiguration on a modified QSslConfiguration object to-
109 achieve that. The following example illustrates how to change the-
110 protocol to TLSv1_0 in a QSslSocket object:-
111-
112 \snippet code/src_network_ssl_qsslconfiguration.cpp 0-
113-
114 \sa QSsl::SslProtocol, QSslCertificate, QSslCipher, QSslKey,-
115 QSslSocket, QNetworkAccessManager,-
116 QSslSocket::sslConfiguration(), QSslSocket::setSslConfiguration()-
117*/-
118-
119/*!-
120 \enum QSslConfiguration::NextProtocolNegotiationStatus-
121-
122 Describes the status of the Next Protocol Negotiation (NPN).-
123-
124 \value NextProtocolNegotiationNone No application protocol-
125 has been negotiated (yet).-
126-
127 \value NextProtocolNegotiationNegotiated A next protocol-
128 has been negotiated (see nextNegotiatedProtocol()).-
129-
130 \value NextProtocolNegotiationUnsupported The client and-
131 server could not agree on a common next application protocol.-
132*/-
133-
134/*!-
135 \variable QSslConfiguration::NextProtocolSpdy3_0-
136 \brief The value used for negotiating SPDY 3.0 during the Next-
137 Protocol Negotiation.-
138*/-
139-
140/*!-
141 \variable QSslConfiguration::NextProtocolHttp1_1-
142 \brief The value used for negotiating HTTP 1.1 during the Next-
143 Protocol Negotiation.-
144*/-
145-
146/*!-
147 Constructs an empty SSL configuration. This configuration contains-
148 no valid settings and the state will be empty. isNull() will-
149 return true after this constructor is called.-
150-
151 Once any setter methods are called, isNull() will return false.-
152*/-
153QSslConfiguration::QSslConfiguration()-
154 : d(new QSslConfigurationPrivate)-
155{-
156}
executed 5898 times by 12 tests: end of block
Executed by:
  • tst_NetworkSelfTest
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
5898
157-
158/*!-
159 Copies the configuration and state of \a other. If \a other is-
160 null, this object will be null too.-
161*/-
162QSslConfiguration::QSslConfiguration(const QSslConfiguration &other)-
163 : d(other.d)-
164{-
165}
executed 1931 times by 9 tests: end of block
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qsslsocket - unknown status
1931
166-
167/*!-
168 Releases any resources held by QSslConfiguration.-
169*/-
170QSslConfiguration::~QSslConfiguration()-
171{-
172 // QSharedDataPointer deletes d for us if necessary-
173}-
174-
175/*!-
176 Copies the configuration and state of \a other. If \a other is-
177 null, this object will be null too.-
178*/-
179QSslConfiguration &QSslConfiguration::operator=(const QSslConfiguration &other)-
180{-
181 d = other.d;-
182 return *this;
executed 1484 times by 7 tests: return *this;
Executed by:
  • tst_NetworkSelfTest
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
1484
183}-
184-
185/*!-
186 \fn void QSslConfiguration::swap(QSslConfiguration &other)-
187 \since 5.0-
188-
189 Swaps this SSL configuration instance with \a other. This function-
190 is very fast and never fails.-
191*/-
192-
193/*!-
194 Returns \c true if this QSslConfiguration object is equal to \a-
195 other.-
196-
197 Two QSslConfiguration objects are considered equal if they have-
198 the exact same settings and state.-
199-
200 \sa operator!=()-
201*/-
202bool QSslConfiguration::operator==(const QSslConfiguration &other) const-
203{-
204 if (d == other.d)
d == other.dDescription
TRUEevaluated 40 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
FALSEevaluated 62 times by 3 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
40-62
205 return true;
executed 40 times by 2 tests: return true;
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
40
206 return d->peerCertificate == other.d->peerCertificate &&
executed 62 times by 3 tests: return d->peerCertificate == other.d->peerCertificate && d->peerCertificateChain == other.d->peerCertificateChain && d->localCertificateChain == other.d->localCertificateChain && d->privateKey == other.d->privateKey && d->sessionCipher == other.d->session...ifeTimeHint == other.d->sslSessionTicketLifeTimeHint && d->nextAllowedProtocols == other.d->nextAllowedProtocols && d->nextNegotiatedProtocol == other.d->nextNegotiatedProtocol && d->nextProtocolNegotiationStatus == other.d->nextProtocolNegotiationStatus;
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
62
207 d->peerCertificateChain == other.d->peerCertificateChain &&
executed 62 times by 3 tests: return d->peerCertificate == other.d->peerCertificate && d->peerCertificateChain == other.d->peerCertificateChain && d->localCertificateChain == other.d->localCertificateChain && d->privateKey == other.d->privateKey && d->sessionCipher == other.d->session...ifeTimeHint == other.d->sslSessionTicketLifeTimeHint && d->nextAllowedProtocols == other.d->nextAllowedProtocols && d->nextNegotiatedProtocol == other.d->nextNegotiatedProtocol && d->nextProtocolNegotiationStatus == other.d->nextProtocolNegotiationStatus;
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
62
208 d->localCertificateChain == other.d->localCertificateChain &&
executed 62 times by 3 tests: return d->peerCertificate == other.d->peerCertificate && d->peerCertificateChain == other.d->peerCertificateChain && d->localCertificateChain == other.d->localCertificateChain && d->privateKey == other.d->privateKey && d->sessionCipher == other.d->session...ifeTimeHint == other.d->sslSessionTicketLifeTimeHint && d->nextAllowedProtocols == other.d->nextAllowedProtocols && d->nextNegotiatedProtocol == other.d->nextNegotiatedProtocol && d->nextProtocolNegotiationStatus == other.d->nextProtocolNegotiationStatus;
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
62
209 d->privateKey == other.d->privateKey &&
executed 62 times by 3 tests: return d->peerCertificate == other.d->peerCertificate && d->peerCertificateChain == other.d->peerCertificateChain && d->localCertificateChain == other.d->localCertificateChain && d->privateKey == other.d->privateKey && d->sessionCipher == other.d->session...ifeTimeHint == other.d->sslSessionTicketLifeTimeHint && d->nextAllowedProtocols == other.d->nextAllowedProtocols && d->nextNegotiatedProtocol == other.d->nextNegotiatedProtocol && d->nextProtocolNegotiationStatus == other.d->nextProtocolNegotiationStatus;
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
62
210 d->sessionCipher == other.d->sessionCipher &&
executed 62 times by 3 tests: return d->peerCertificate == other.d->peerCertificate && d->peerCertificateChain == other.d->peerCertificateChain && d->localCertificateChain == other.d->localCertificateChain && d->privateKey == other.d->privateKey && d->sessionCipher == other.d->session...ifeTimeHint == other.d->sslSessionTicketLifeTimeHint && d->nextAllowedProtocols == other.d->nextAllowedProtocols && d->nextNegotiatedProtocol == other.d->nextNegotiatedProtocol && d->nextProtocolNegotiationStatus == other.d->nextProtocolNegotiationStatus;
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
62
211 d->sessionProtocol == other.d->sessionProtocol &&
executed 62 times by 3 tests: return d->peerCertificate == other.d->peerCertificate && d->peerCertificateChain == other.d->peerCertificateChain && d->localCertificateChain == other.d->localCertificateChain && d->privateKey == other.d->privateKey && d->sessionCipher == other.d->session...ifeTimeHint == other.d->sslSessionTicketLifeTimeHint && d->nextAllowedProtocols == other.d->nextAllowedProtocols && d->nextNegotiatedProtocol == other.d->nextNegotiatedProtocol && d->nextProtocolNegotiationStatus == other.d->nextProtocolNegotiationStatus;
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
62
212 d->ciphers == other.d->ciphers &&
executed 62 times by 3 tests: return d->peerCertificate == other.d->peerCertificate && d->peerCertificateChain == other.d->peerCertificateChain && d->localCertificateChain == other.d->localCertificateChain && d->privateKey == other.d->privateKey && d->sessionCipher == other.d->session...ifeTimeHint == other.d->sslSessionTicketLifeTimeHint && d->nextAllowedProtocols == other.d->nextAllowedProtocols && d->nextNegotiatedProtocol == other.d->nextNegotiatedProtocol && d->nextProtocolNegotiationStatus == other.d->nextProtocolNegotiationStatus;
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
62
213 d->ellipticCurves == other.d->ellipticCurves &&
executed 62 times by 3 tests: return d->peerCertificate == other.d->peerCertificate && d->peerCertificateChain == other.d->peerCertificateChain && d->localCertificateChain == other.d->localCertificateChain && d->privateKey == other.d->privateKey && d->sessionCipher == other.d->session...ifeTimeHint == other.d->sslSessionTicketLifeTimeHint && d->nextAllowedProtocols == other.d->nextAllowedProtocols && d->nextNegotiatedProtocol == other.d->nextNegotiatedProtocol && d->nextProtocolNegotiationStatus == other.d->nextProtocolNegotiationStatus;
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
62
214 d->ephemeralServerKey == other.d->ephemeralServerKey &&
executed 62 times by 3 tests: return d->peerCertificate == other.d->peerCertificate && d->peerCertificateChain == other.d->peerCertificateChain && d->localCertificateChain == other.d->localCertificateChain && d->privateKey == other.d->privateKey && d->sessionCipher == other.d->session...ifeTimeHint == other.d->sslSessionTicketLifeTimeHint && d->nextAllowedProtocols == other.d->nextAllowedProtocols && d->nextNegotiatedProtocol == other.d->nextNegotiatedProtocol && d->nextProtocolNegotiationStatus == other.d->nextProtocolNegotiationStatus;
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
62
215 d->caCertificates == other.d->caCertificates &&
executed 62 times by 3 tests: return d->peerCertificate == other.d->peerCertificate && d->peerCertificateChain == other.d->peerCertificateChain && d->localCertificateChain == other.d->localCertificateChain && d->privateKey == other.d->privateKey && d->sessionCipher == other.d->session...ifeTimeHint == other.d->sslSessionTicketLifeTimeHint && d->nextAllowedProtocols == other.d->nextAllowedProtocols && d->nextNegotiatedProtocol == other.d->nextNegotiatedProtocol && d->nextProtocolNegotiationStatus == other.d->nextProtocolNegotiationStatus;
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
62
216 d->protocol == other.d->protocol &&
executed 62 times by 3 tests: return d->peerCertificate == other.d->peerCertificate && d->peerCertificateChain == other.d->peerCertificateChain && d->localCertificateChain == other.d->localCertificateChain && d->privateKey == other.d->privateKey && d->sessionCipher == other.d->session...ifeTimeHint == other.d->sslSessionTicketLifeTimeHint && d->nextAllowedProtocols == other.d->nextAllowedProtocols && d->nextNegotiatedProtocol == other.d->nextNegotiatedProtocol && d->nextProtocolNegotiationStatus == other.d->nextProtocolNegotiationStatus;
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
62
217 d->peerVerifyMode == other.d->peerVerifyMode &&
executed 62 times by 3 tests: return d->peerCertificate == other.d->peerCertificate && d->peerCertificateChain == other.d->peerCertificateChain && d->localCertificateChain == other.d->localCertificateChain && d->privateKey == other.d->privateKey && d->sessionCipher == other.d->session...ifeTimeHint == other.d->sslSessionTicketLifeTimeHint && d->nextAllowedProtocols == other.d->nextAllowedProtocols && d->nextNegotiatedProtocol == other.d->nextNegotiatedProtocol && d->nextProtocolNegotiationStatus == other.d->nextProtocolNegotiationStatus;
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
62
218 d->peerVerifyDepth == other.d->peerVerifyDepth &&
executed 62 times by 3 tests: return d->peerCertificate == other.d->peerCertificate && d->peerCertificateChain == other.d->peerCertificateChain && d->localCertificateChain == other.d->localCertificateChain && d->privateKey == other.d->privateKey && d->sessionCipher == other.d->session...ifeTimeHint == other.d->sslSessionTicketLifeTimeHint && d->nextAllowedProtocols == other.d->nextAllowedProtocols && d->nextNegotiatedProtocol == other.d->nextNegotiatedProtocol && d->nextProtocolNegotiationStatus == other.d->nextProtocolNegotiationStatus;
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
62
219 d->allowRootCertOnDemandLoading == other.d->allowRootCertOnDemandLoading &&
executed 62 times by 3 tests: return d->peerCertificate == other.d->peerCertificate && d->peerCertificateChain == other.d->peerCertificateChain && d->localCertificateChain == other.d->localCertificateChain && d->privateKey == other.d->privateKey && d->sessionCipher == other.d->session...ifeTimeHint == other.d->sslSessionTicketLifeTimeHint && d->nextAllowedProtocols == other.d->nextAllowedProtocols && d->nextNegotiatedProtocol == other.d->nextNegotiatedProtocol && d->nextProtocolNegotiationStatus == other.d->nextProtocolNegotiationStatus;
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
62
220 d->sslOptions == other.d->sslOptions &&
executed 62 times by 3 tests: return d->peerCertificate == other.d->peerCertificate && d->peerCertificateChain == other.d->peerCertificateChain && d->localCertificateChain == other.d->localCertificateChain && d->privateKey == other.d->privateKey && d->sessionCipher == other.d->session...ifeTimeHint == other.d->sslSessionTicketLifeTimeHint && d->nextAllowedProtocols == other.d->nextAllowedProtocols && d->nextNegotiatedProtocol == other.d->nextNegotiatedProtocol && d->nextProtocolNegotiationStatus == other.d->nextProtocolNegotiationStatus;
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
62
221 d->sslSession == other.d->sslSession &&
executed 62 times by 3 tests: return d->peerCertificate == other.d->peerCertificate && d->peerCertificateChain == other.d->peerCertificateChain && d->localCertificateChain == other.d->localCertificateChain && d->privateKey == other.d->privateKey && d->sessionCipher == other.d->session...ifeTimeHint == other.d->sslSessionTicketLifeTimeHint && d->nextAllowedProtocols == other.d->nextAllowedProtocols && d->nextNegotiatedProtocol == other.d->nextNegotiatedProtocol && d->nextProtocolNegotiationStatus == other.d->nextProtocolNegotiationStatus;
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
62
222 d->sslSessionTicketLifeTimeHint == other.d->sslSessionTicketLifeTimeHint &&
executed 62 times by 3 tests: return d->peerCertificate == other.d->peerCertificate && d->peerCertificateChain == other.d->peerCertificateChain && d->localCertificateChain == other.d->localCertificateChain && d->privateKey == other.d->privateKey && d->sessionCipher == other.d->session...ifeTimeHint == other.d->sslSessionTicketLifeTimeHint && d->nextAllowedProtocols == other.d->nextAllowedProtocols && d->nextNegotiatedProtocol == other.d->nextNegotiatedProtocol && d->nextProtocolNegotiationStatus == other.d->nextProtocolNegotiationStatus;
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
62
223 d->nextAllowedProtocols == other.d->nextAllowedProtocols &&
executed 62 times by 3 tests: return d->peerCertificate == other.d->peerCertificate && d->peerCertificateChain == other.d->peerCertificateChain && d->localCertificateChain == other.d->localCertificateChain && d->privateKey == other.d->privateKey && d->sessionCipher == other.d->session...ifeTimeHint == other.d->sslSessionTicketLifeTimeHint && d->nextAllowedProtocols == other.d->nextAllowedProtocols && d->nextNegotiatedProtocol == other.d->nextNegotiatedProtocol && d->nextProtocolNegotiationStatus == other.d->nextProtocolNegotiationStatus;
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
62
224 d->nextNegotiatedProtocol == other.d->nextNegotiatedProtocol &&
executed 62 times by 3 tests: return d->peerCertificate == other.d->peerCertificate && d->peerCertificateChain == other.d->peerCertificateChain && d->localCertificateChain == other.d->localCertificateChain && d->privateKey == other.d->privateKey && d->sessionCipher == other.d->session...ifeTimeHint == other.d->sslSessionTicketLifeTimeHint && d->nextAllowedProtocols == other.d->nextAllowedProtocols && d->nextNegotiatedProtocol == other.d->nextNegotiatedProtocol && d->nextProtocolNegotiationStatus == other.d->nextProtocolNegotiationStatus;
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
62
225 d->nextProtocolNegotiationStatus == other.d->nextProtocolNegotiationStatus;
executed 62 times by 3 tests: return d->peerCertificate == other.d->peerCertificate && d->peerCertificateChain == other.d->peerCertificateChain && d->localCertificateChain == other.d->localCertificateChain && d->privateKey == other.d->privateKey && d->sessionCipher == other.d->session...ifeTimeHint == other.d->sslSessionTicketLifeTimeHint && d->nextAllowedProtocols == other.d->nextAllowedProtocols && d->nextNegotiatedProtocol == other.d->nextNegotiatedProtocol && d->nextProtocolNegotiationStatus == other.d->nextProtocolNegotiationStatus;
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
62
226}-
227-
228/*!-
229 \fn QSslConfiguration::operator!=(const QSslConfiguration &other) const-
230-
231 Returns \c true if this QSslConfiguration differs from \a other. Two-
232 QSslConfiguration objects are considered different if any state or-
233 setting is different.-
234-
235 \sa operator==()-
236*/-
237-
238/*!-
239 Returns \c true if this is a null QSslConfiguration object.-
240-
241 A QSslConfiguration object is null if it has been-
242 default-constructed and no setter methods have been called.-
243-
244 \sa setProtocol(), setLocalCertificate(), setPrivateKey(),-
245 setCiphers(), setCaCertificates()-
246*/-
247bool QSslConfiguration::isNull() const-
248{-
249 return (d->protocol == QSsl::SecureProtocols &&
executed 231 times by 3 tests: return (d->protocol == QSsl::SecureProtocols && d->peerVerifyMode == QSslSocket::AutoVerifyPeer && d->peerVerifyDepth == 0 && d->allowRootCertOnDemandLoading == true && d->caCertificates.count() == 0 && d->ciphers.count() == 0 && d->ellipticCurves.isEmpty...rivate::defaultSslOptions && d->sslSession.isNull() && d->sslSessionTicketLifeTimeHint == -1 && d->nextAllowedProtocols.isEmpty() && d->nextNegotiatedProtocol.isNull() && d->nextProtocolNegotiationStatus == QSslConfiguration::NextProtocolNegotiationNone);
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
231
250 d->peerVerifyMode == QSslSocket::AutoVerifyPeer &&
executed 231 times by 3 tests: return (d->protocol == QSsl::SecureProtocols && d->peerVerifyMode == QSslSocket::AutoVerifyPeer && d->peerVerifyDepth == 0 && d->allowRootCertOnDemandLoading == true && d->caCertificates.count() == 0 && d->ciphers.count() == 0 && d->ellipticCurves.isEmpty...rivate::defaultSslOptions && d->sslSession.isNull() && d->sslSessionTicketLifeTimeHint == -1 && d->nextAllowedProtocols.isEmpty() && d->nextNegotiatedProtocol.isNull() && d->nextProtocolNegotiationStatus == QSslConfiguration::NextProtocolNegotiationNone);
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
231
251 d->peerVerifyDepth == 0 &&
executed 231 times by 3 tests: return (d->protocol == QSsl::SecureProtocols && d->peerVerifyMode == QSslSocket::AutoVerifyPeer && d->peerVerifyDepth == 0 && d->allowRootCertOnDemandLoading == true && d->caCertificates.count() == 0 && d->ciphers.count() == 0 && d->ellipticCurves.isEmpty...rivate::defaultSslOptions && d->sslSession.isNull() && d->sslSessionTicketLifeTimeHint == -1 && d->nextAllowedProtocols.isEmpty() && d->nextNegotiatedProtocol.isNull() && d->nextProtocolNegotiationStatus == QSslConfiguration::NextProtocolNegotiationNone);
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
231
252 d->allowRootCertOnDemandLoading == true &&
executed 231 times by 3 tests: return (d->protocol == QSsl::SecureProtocols && d->peerVerifyMode == QSslSocket::AutoVerifyPeer && d->peerVerifyDepth == 0 && d->allowRootCertOnDemandLoading == true && d->caCertificates.count() == 0 && d->ciphers.count() == 0 && d->ellipticCurves.isEmpty...rivate::defaultSslOptions && d->sslSession.isNull() && d->sslSessionTicketLifeTimeHint == -1 && d->nextAllowedProtocols.isEmpty() && d->nextNegotiatedProtocol.isNull() && d->nextProtocolNegotiationStatus == QSslConfiguration::NextProtocolNegotiationNone);
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
231
253 d->caCertificates.count() == 0 &&
executed 231 times by 3 tests: return (d->protocol == QSsl::SecureProtocols && d->peerVerifyMode == QSslSocket::AutoVerifyPeer && d->peerVerifyDepth == 0 && d->allowRootCertOnDemandLoading == true && d->caCertificates.count() == 0 && d->ciphers.count() == 0 && d->ellipticCurves.isEmpty...rivate::defaultSslOptions && d->sslSession.isNull() && d->sslSessionTicketLifeTimeHint == -1 && d->nextAllowedProtocols.isEmpty() && d->nextNegotiatedProtocol.isNull() && d->nextProtocolNegotiationStatus == QSslConfiguration::NextProtocolNegotiationNone);
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
231
254 d->ciphers.count() == 0 &&
executed 231 times by 3 tests: return (d->protocol == QSsl::SecureProtocols && d->peerVerifyMode == QSslSocket::AutoVerifyPeer && d->peerVerifyDepth == 0 && d->allowRootCertOnDemandLoading == true && d->caCertificates.count() == 0 && d->ciphers.count() == 0 && d->ellipticCurves.isEmpty...rivate::defaultSslOptions && d->sslSession.isNull() && d->sslSessionTicketLifeTimeHint == -1 && d->nextAllowedProtocols.isEmpty() && d->nextNegotiatedProtocol.isNull() && d->nextProtocolNegotiationStatus == QSslConfiguration::NextProtocolNegotiationNone);
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
231
255 d->ellipticCurves.isEmpty() &&
executed 231 times by 3 tests: return (d->protocol == QSsl::SecureProtocols && d->peerVerifyMode == QSslSocket::AutoVerifyPeer && d->peerVerifyDepth == 0 && d->allowRootCertOnDemandLoading == true && d->caCertificates.count() == 0 && d->ciphers.count() == 0 && d->ellipticCurves.isEmpty...rivate::defaultSslOptions && d->sslSession.isNull() && d->sslSessionTicketLifeTimeHint == -1 && d->nextAllowedProtocols.isEmpty() && d->nextNegotiatedProtocol.isNull() && d->nextProtocolNegotiationStatus == QSslConfiguration::NextProtocolNegotiationNone);
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
231
256 d->ephemeralServerKey.isNull() &&
executed 231 times by 3 tests: return (d->protocol == QSsl::SecureProtocols && d->peerVerifyMode == QSslSocket::AutoVerifyPeer && d->peerVerifyDepth == 0 && d->allowRootCertOnDemandLoading == true && d->caCertificates.count() == 0 && d->ciphers.count() == 0 && d->ellipticCurves.isEmpty...rivate::defaultSslOptions && d->sslSession.isNull() && d->sslSessionTicketLifeTimeHint == -1 && d->nextAllowedProtocols.isEmpty() && d->nextNegotiatedProtocol.isNull() && d->nextProtocolNegotiationStatus == QSslConfiguration::NextProtocolNegotiationNone);
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
231
257 d->localCertificateChain.isEmpty() &&
executed 231 times by 3 tests: return (d->protocol == QSsl::SecureProtocols && d->peerVerifyMode == QSslSocket::AutoVerifyPeer && d->peerVerifyDepth == 0 && d->allowRootCertOnDemandLoading == true && d->caCertificates.count() == 0 && d->ciphers.count() == 0 && d->ellipticCurves.isEmpty...rivate::defaultSslOptions && d->sslSession.isNull() && d->sslSessionTicketLifeTimeHint == -1 && d->nextAllowedProtocols.isEmpty() && d->nextNegotiatedProtocol.isNull() && d->nextProtocolNegotiationStatus == QSslConfiguration::NextProtocolNegotiationNone);
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
231
258 d->privateKey.isNull() &&
executed 231 times by 3 tests: return (d->protocol == QSsl::SecureProtocols && d->peerVerifyMode == QSslSocket::AutoVerifyPeer && d->peerVerifyDepth == 0 && d->allowRootCertOnDemandLoading == true && d->caCertificates.count() == 0 && d->ciphers.count() == 0 && d->ellipticCurves.isEmpty...rivate::defaultSslOptions && d->sslSession.isNull() && d->sslSessionTicketLifeTimeHint == -1 && d->nextAllowedProtocols.isEmpty() && d->nextNegotiatedProtocol.isNull() && d->nextProtocolNegotiationStatus == QSslConfiguration::NextProtocolNegotiationNone);
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
231
259 d->peerCertificate.isNull() &&
executed 231 times by 3 tests: return (d->protocol == QSsl::SecureProtocols && d->peerVerifyMode == QSslSocket::AutoVerifyPeer && d->peerVerifyDepth == 0 && d->allowRootCertOnDemandLoading == true && d->caCertificates.count() == 0 && d->ciphers.count() == 0 && d->ellipticCurves.isEmpty...rivate::defaultSslOptions && d->sslSession.isNull() && d->sslSessionTicketLifeTimeHint == -1 && d->nextAllowedProtocols.isEmpty() && d->nextNegotiatedProtocol.isNull() && d->nextProtocolNegotiationStatus == QSslConfiguration::NextProtocolNegotiationNone);
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
231
260 d->peerCertificateChain.count() == 0 &&
executed 231 times by 3 tests: return (d->protocol == QSsl::SecureProtocols && d->peerVerifyMode == QSslSocket::AutoVerifyPeer && d->peerVerifyDepth == 0 && d->allowRootCertOnDemandLoading == true && d->caCertificates.count() == 0 && d->ciphers.count() == 0 && d->ellipticCurves.isEmpty...rivate::defaultSslOptions && d->sslSession.isNull() && d->sslSessionTicketLifeTimeHint == -1 && d->nextAllowedProtocols.isEmpty() && d->nextNegotiatedProtocol.isNull() && d->nextProtocolNegotiationStatus == QSslConfiguration::NextProtocolNegotiationNone);
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
231
261 d->sslOptions == QSslConfigurationPrivate::defaultSslOptions &&
executed 231 times by 3 tests: return (d->protocol == QSsl::SecureProtocols && d->peerVerifyMode == QSslSocket::AutoVerifyPeer && d->peerVerifyDepth == 0 && d->allowRootCertOnDemandLoading == true && d->caCertificates.count() == 0 && d->ciphers.count() == 0 && d->ellipticCurves.isEmpty...rivate::defaultSslOptions && d->sslSession.isNull() && d->sslSessionTicketLifeTimeHint == -1 && d->nextAllowedProtocols.isEmpty() && d->nextNegotiatedProtocol.isNull() && d->nextProtocolNegotiationStatus == QSslConfiguration::NextProtocolNegotiationNone);
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
231
262 d->sslSession.isNull() &&
executed 231 times by 3 tests: return (d->protocol == QSsl::SecureProtocols && d->peerVerifyMode == QSslSocket::AutoVerifyPeer && d->peerVerifyDepth == 0 && d->allowRootCertOnDemandLoading == true && d->caCertificates.count() == 0 && d->ciphers.count() == 0 && d->ellipticCurves.isEmpty...rivate::defaultSslOptions && d->sslSession.isNull() && d->sslSessionTicketLifeTimeHint == -1 && d->nextAllowedProtocols.isEmpty() && d->nextNegotiatedProtocol.isNull() && d->nextProtocolNegotiationStatus == QSslConfiguration::NextProtocolNegotiationNone);
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
231
263 d->sslSessionTicketLifeTimeHint == -1 &&
executed 231 times by 3 tests: return (d->protocol == QSsl::SecureProtocols && d->peerVerifyMode == QSslSocket::AutoVerifyPeer && d->peerVerifyDepth == 0 && d->allowRootCertOnDemandLoading == true && d->caCertificates.count() == 0 && d->ciphers.count() == 0 && d->ellipticCurves.isEmpty...rivate::defaultSslOptions && d->sslSession.isNull() && d->sslSessionTicketLifeTimeHint == -1 && d->nextAllowedProtocols.isEmpty() && d->nextNegotiatedProtocol.isNull() && d->nextProtocolNegotiationStatus == QSslConfiguration::NextProtocolNegotiationNone);
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
231
264 d->nextAllowedProtocols.isEmpty() &&
executed 231 times by 3 tests: return (d->protocol == QSsl::SecureProtocols && d->peerVerifyMode == QSslSocket::AutoVerifyPeer && d->peerVerifyDepth == 0 && d->allowRootCertOnDemandLoading == true && d->caCertificates.count() == 0 && d->ciphers.count() == 0 && d->ellipticCurves.isEmpty...rivate::defaultSslOptions && d->sslSession.isNull() && d->sslSessionTicketLifeTimeHint == -1 && d->nextAllowedProtocols.isEmpty() && d->nextNegotiatedProtocol.isNull() && d->nextProtocolNegotiationStatus == QSslConfiguration::NextProtocolNegotiationNone);
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
231
265 d->nextNegotiatedProtocol.isNull() &&
executed 231 times by 3 tests: return (d->protocol == QSsl::SecureProtocols && d->peerVerifyMode == QSslSocket::AutoVerifyPeer && d->peerVerifyDepth == 0 && d->allowRootCertOnDemandLoading == true && d->caCertificates.count() == 0 && d->ciphers.count() == 0 && d->ellipticCurves.isEmpty...rivate::defaultSslOptions && d->sslSession.isNull() && d->sslSessionTicketLifeTimeHint == -1 && d->nextAllowedProtocols.isEmpty() && d->nextNegotiatedProtocol.isNull() && d->nextProtocolNegotiationStatus == QSslConfiguration::NextProtocolNegotiationNone);
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
231
266 d->nextProtocolNegotiationStatus == QSslConfiguration::NextProtocolNegotiationNone);
executed 231 times by 3 tests: return (d->protocol == QSsl::SecureProtocols && d->peerVerifyMode == QSslSocket::AutoVerifyPeer && d->peerVerifyDepth == 0 && d->allowRootCertOnDemandLoading == true && d->caCertificates.count() == 0 && d->ciphers.count() == 0 && d->ellipticCurves.isEmpty...rivate::defaultSslOptions && d->sslSession.isNull() && d->sslSessionTicketLifeTimeHint == -1 && d->nextAllowedProtocols.isEmpty() && d->nextNegotiatedProtocol.isNull() && d->nextProtocolNegotiationStatus == QSslConfiguration::NextProtocolNegotiationNone);
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
231
267}-
268-
269/*!-
270 Returns the protocol setting for this SSL configuration.-
271-
272 \sa setProtocol()-
273*/-
274QSsl::SslProtocol QSslConfiguration::protocol() const-
275{-
276 return d->protocol;
executed 1055 times by 7 tests: return d->protocol;
Executed by:
  • tst_NetworkSelfTest
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
1055
277}-
278-
279/*!-
280 Sets the protocol setting for this configuration to be \a-
281 protocol.-
282-
283 Setting the protocol once the connection has already been-
284 established has no effect.-
285-
286 \sa protocol()-
287*/-
288void QSslConfiguration::setProtocol(QSsl::SslProtocol protocol)-
289{-
290 d->protocol = protocol;-
291}
executed 2 times by 2 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_qsslsocket - unknown status
2
292-
293/*!-
294 Returns the verify mode. This mode decides whether QSslSocket should-
295 request a certificate from the peer (i.e., the client requests a-
296 certificate from the server, or a server requesting a certificate from the-
297 client), and whether it should require that this certificate is valid.-
298-
299 The default mode is AutoVerifyPeer, which tells QSslSocket to use-
300 VerifyPeer for clients, QueryPeer for servers.-
301-
302 \sa setPeerVerifyMode()-
303*/-
304QSslSocket::PeerVerifyMode QSslConfiguration::peerVerifyMode() const-
305{-
306 return d->peerVerifyMode;
executed 589 times by 7 tests: return d->peerVerifyMode;
Executed by:
  • tst_NetworkSelfTest
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
589
307}-
308-
309/*!-
310 Sets the verify mode to \a mode. This mode decides whether QSslSocket-
311 should request a certificate from the peer (i.e., the client requests a-
312 certificate from the server, or a server requesting a certificate from the-
313 client), and whether it should require that this certificate is valid.-
314-
315 The default mode is AutoVerifyPeer, which tells QSslSocket to use-
316 VerifyPeer for clients, QueryPeer for servers.-
317-
318 \sa peerVerifyMode()-
319*/-
320void QSslConfiguration::setPeerVerifyMode(QSslSocket::PeerVerifyMode mode)-
321{-
322 d->peerVerifyMode = mode;-
323}
never executed: end of block
0
324-
325-
326/*!-
327 Returns the maximum number of certificates in the peer's certificate chain-
328 to be checked during the SSL handshake phase, or 0 (the default) if no-
329 maximum depth has been set, indicating that the whole certificate chain-
330 should be checked.-
331-
332 The certificates are checked in issuing order, starting with the peer's-
333 own certificate, then its issuer's certificate, and so on.-
334-
335 \sa setPeerVerifyDepth(), peerVerifyMode()-
336*/-
337int QSslConfiguration::peerVerifyDepth() const-
338{-
339 return d->peerVerifyDepth;
executed 589 times by 7 tests: return d->peerVerifyDepth;
Executed by:
  • tst_NetworkSelfTest
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
589
340}-
341-
342/*!-
343 Sets the maximum number of certificates in the peer's certificate chain to-
344 be checked during the SSL handshake phase, to \a depth. Setting a depth of-
345 0 means that no maximum depth is set, indicating that the whole-
346 certificate chain should be checked.-
347-
348 The certificates are checked in issuing order, starting with the peer's-
349 own certificate, then its issuer's certificate, and so on.-
350-
351 \sa peerVerifyDepth(), setPeerVerifyMode()-
352*/-
353void QSslConfiguration::setPeerVerifyDepth(int depth)-
354{-
355 if (depth < 0) {
depth < 0Description
TRUEnever evaluated
FALSEnever evaluated
0
356 qCWarning(lcSsl,
never executed: QMessageLogger( __FILE__ , 357 , __PRETTY_FUNCTION__, lcSsl().categoryName()).warning("QSslConfiguration::setPeerVerifyDepth: cannot set negative depth of %d", depth) ;
qt_category_enabledDescription
TRUEnever evaluated
FALSEnever evaluated
0
357 "QSslConfiguration::setPeerVerifyDepth: cannot set negative depth of %d", depth);
never executed: QMessageLogger( __FILE__ , 357 , __PRETTY_FUNCTION__, lcSsl().categoryName()).warning("QSslConfiguration::setPeerVerifyDepth: cannot set negative depth of %d", depth) ;
0
358 return;
never executed: return;
0
359 }-
360 d->peerVerifyDepth = depth;-
361}
never executed: end of block
0
362-
363/*!-
364 Returns the certificate chain to be presented to the peer during-
365 the SSL handshake process.-
366-
367 \sa localCertificate()-
368 \since 5.1-
369*/-
370QList<QSslCertificate> QSslConfiguration::localCertificateChain() const-
371{-
372 return d->localCertificateChain;
executed 144 times by 4 tests: return d->localCertificateChain;
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
144
373}-
374-
375/*!-
376 Sets the certificate chain to be presented to the peer during the-
377 SSL handshake to be \a localChain.-
378-
379 Setting the certificate chain once the connection has been-
380 established has no effect.-
381-
382 A certificate is the means of identification used in the SSL-
383 process. The local certificate is used by the remote end to verify-
384 the local user's identity against its list of Certification-
385 Authorities. In most cases, such as in HTTP web browsing, only-
386 servers identify to the clients, so the client does not send a-
387 certificate.-
388-
389 Unlike QSslConfiguration::setLocalCertificate() this method allows-
390 you to specify any intermediate certificates required in order to-
391 validate your certificate. The first item in the list must be the-
392 leaf certificate.-
393-
394 \sa localCertificateChain()-
395 \since 5.1-
396 */-
397void QSslConfiguration::setLocalCertificateChain(const QList<QSslCertificate> &localChain)-
398{-
399 d->localCertificateChain = localChain;-
400}
never executed: end of block
0
401-
402/*!-
403 Returns the certificate to be presented to the peer during the SSL-
404 handshake process.-
405-
406 \sa setLocalCertificate()-
407*/-
408QSslCertificate QSslConfiguration::localCertificate() const-
409{-
410 if (d->localCertificateChain.isEmpty())
d->localCertif...hain.isEmpty()Description
TRUEevaluated 362 times by 7 tests
Evaluated by:
  • tst_NetworkSelfTest
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
FALSEevaluated 182 times by 2 tests
Evaluated by:
  • tst_QNetworkReply
  • tst_qsslsocket - unknown status
182-362
411 return QSslCertificate();
executed 362 times by 7 tests: return QSslCertificate();
Executed by:
  • tst_NetworkSelfTest
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
362
412 return d->localCertificateChain[0];
executed 182 times by 2 tests: return d->localCertificateChain[0];
Executed by:
  • tst_QNetworkReply
  • tst_qsslsocket - unknown status
182
413}-
414-
415/*!-
416 Sets the certificate to be presented to the peer during SSL-
417 handshake to be \a certificate.-
418-
419 Setting the certificate once the connection has been established-
420 has no effect.-
421-
422 A certificate is the means of identification used in the SSL-
423 process. The local certificate is used by the remote end to verify-
424 the local user's identity against its list of Certification-
425 Authorities. In most cases, such as in HTTP web browsing, only-
426 servers identify to the clients, so the client does not send a-
427 certificate.-
428-
429 \sa localCertificate()-
430*/-
431void QSslConfiguration::setLocalCertificate(const QSslCertificate &certificate)-
432{-
433 d->localCertificateChain = QList<QSslCertificate>();-
434 d->localCertificateChain += certificate;-
435}
never executed: end of block
0
436-
437/*!-
438 Returns the peer's digital certificate (i.e., the immediate-
439 certificate of the host you are connected to), or a null-
440 certificate, if the peer has not assigned a certificate.-
441-
442 The peer certificate is checked automatically during the-
443 handshake phase, so this function is normally used to fetch-
444 the certificate for display or for connection diagnostic-
445 purposes. It contains information about the peer, including-
446 its host name, the certificate issuer, and the peer's public-
447 key.-
448-
449 Because the peer certificate is set during the handshake phase, it-
450 is safe to access the peer certificate from a slot connected to-
451 the QSslSocket::sslErrors() signal, QNetworkReply::sslErrors()-
452 signal, or the QSslSocket::encrypted() signal.-
453-
454 If a null certificate is returned, it can mean the SSL handshake-
455 failed, or it can mean the host you are connected to doesn't have-
456 a certificate, or it can mean there is no connection.-
457-
458 If you want to check the peer's complete chain of certificates,-
459 use peerCertificateChain() to get them all at once.-
460-
461 \sa peerCertificateChain(),-
462 QSslSocket::sslErrors(), QSslSocket::ignoreSslErrors(),-
463 QNetworkReply::sslErrors(), QNetworkReply::ignoreSslErrors()-
464*/-
465QSslCertificate QSslConfiguration::peerCertificate() const-
466{-
467 return d->peerCertificate;
never executed: return d->peerCertificate;
0
468}-
469-
470/*!-
471 Returns the peer's chain of digital certificates, starting with-
472 the peer's immediate certificate and ending with the CA's-
473 certificate.-
474-
475 Peer certificates are checked automatically during the handshake-
476 phase. This function is normally used to fetch certificates for-
477 display, or for performing connection diagnostics. Certificates-
478 contain information about the peer and the certificate issuers,-
479 including host name, issuer names, and issuer public keys.-
480-
481 Because the peer certificate is set during the handshake phase, it-
482 is safe to access the peer certificate from a slot connected to-
483 the QSslSocket::sslErrors() signal, QNetworkReply::sslErrors()-
484 signal, or the QSslSocket::encrypted() signal.-
485-
486 If an empty list is returned, it can mean the SSL handshake-
487 failed, or it can mean the host you are connected to doesn't have-
488 a certificate, or it can mean there is no connection.-
489-
490 If you want to get only the peer's immediate certificate, use-
491 peerCertificate().-
492-
493 \sa peerCertificate(),-
494 QSslSocket::sslErrors(), QSslSocket::ignoreSslErrors(),-
495 QNetworkReply::sslErrors(), QNetworkReply::ignoreSslErrors()-
496*/-
497QList<QSslCertificate> QSslConfiguration::peerCertificateChain() const-
498{-
499 return d->peerCertificateChain;
never executed: return d->peerCertificateChain;
0
500}-
501-
502/*!-
503 Returns the socket's cryptographic \l {QSslCipher} {cipher}, or a-
504 null cipher if the connection isn't encrypted. The socket's cipher-
505 for the session is set during the handshake phase. The cipher is-
506 used to encrypt and decrypt data transmitted through the socket.-
507-
508 The SSL infrastructure also provides functions for setting the-
509 ordered list of ciphers from which the handshake phase will-
510 eventually select the session cipher. This ordered list must be in-
511 place before the handshake phase begins.-
512-
513 \sa ciphers(), setCiphers(), QSslSocket::supportedCiphers()-
514*/-
515QSslCipher QSslConfiguration::sessionCipher() const-
516{-
517 return d->sessionCipher;
never executed: return d->sessionCipher;
0
518}-
519-
520/*!-
521 Returns the socket's SSL/TLS protocol or UnknownProtocol if the-
522 connection isn't encrypted. The socket's protocol for the session-
523 is set during the handshake phase.-
524-
525 \sa protocol(), setProtocol()-
526 \since 5.4-
527*/-
528QSsl::SslProtocol QSslConfiguration::sessionProtocol() const-
529{-
530 return d->sessionProtocol;
never executed: return d->sessionProtocol;
0
531}-
532-
533/*!-
534 Returns the \l {QSslKey} {SSL key} assigned to this connection or-
535 a null key if none has been assigned yet.-
536-
537 \sa setPrivateKey(), localCertificate()-
538*/-
539QSslKey QSslConfiguration::privateKey() const-
540{-
541 return d->privateKey;
executed 228 times by 4 tests: return d->privateKey;
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
228
542}-
543-
544/*!-
545 Sets the connection's private \l {QSslKey} {key} to \a key. The-
546 private key and the local \l {QSslCertificate} {certificate} are-
547 used by clients and servers that must prove their identity to-
548 SSL peers.-
549-
550 Both the key and the local certificate are required if you are-
551 creating an SSL server socket. If you are creating an SSL client-
552 socket, the key and local certificate are required if your client-
553 must identify itself to an SSL server.-
554-
555 \sa privateKey(), setLocalCertificate()-
556*/-
557void QSslConfiguration::setPrivateKey(const QSslKey &key)-
558{-
559 d->privateKey = key;-
560}
never executed: end of block
0
561-
562/*!-
563 Returns this connection's current cryptographic cipher suite. This-
564 list is used during the handshake phase for choosing a-
565 session cipher. The returned list of ciphers is ordered by-
566 descending preference. (i.e., the first cipher in the list is the-
567 most preferred cipher). The session cipher will be the first one-
568 in the list that is also supported by the peer.-
569-
570 By default, the handshake phase can choose any of the ciphers-
571 supported by this system's SSL libraries, which may vary from-
572 system to system. The list of ciphers supported by this system's-
573 SSL libraries is returned by QSslSocket::supportedCiphers(). You can restrict-
574 the list of ciphers used for choosing the session cipher for this-
575 socket by calling setCiphers() with a subset of the supported-
576 ciphers. You can revert to using the entire set by calling-
577 setCiphers() with the list returned by QSslSocket::supportedCiphers().-
578-
579 \sa setCiphers(), QSslSocket::supportedCiphers()-
580*/-
581QList<QSslCipher> QSslConfiguration::ciphers() const-
582{-
583 return d->ciphers;
executed 602 times by 7 tests: return d->ciphers;
Executed by:
  • tst_NetworkSelfTest
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
602
584}-
585-
586/*!-
587 Sets the cryptographic cipher suite for this socket to \a ciphers,-
588 which must contain a subset of the ciphers in the list returned by-
589 supportedCiphers().-
590-
591 Restricting the cipher suite must be done before the handshake-
592 phase, where the session cipher is chosen.-
593-
594 \sa ciphers(), QSslSocket::supportedCiphers()-
595*/-
596void QSslConfiguration::setCiphers(const QList<QSslCipher> &ciphers)-
597{-
598 d->ciphers = ciphers;-
599}
executed 2 times by 1 test: end of block
Executed by:
  • tst_qsslsocket - unknown status
2
600-
601/*!-
602 \since 5.5-
603-
604 Returns the list of cryptographic ciphers supported by this-
605 system. This list is set by the system's SSL libraries and may-
606 vary from system to system.-
607-
608 \sa ciphers(), setCiphers()-
609*/-
610QList<QSslCipher> QSslConfiguration::supportedCiphers()-
611{-
612 return QSslSocketPrivate::supportedCiphers();
executed 43 times by 1 test: return QSslSocketPrivate::supportedCiphers();
Executed by:
  • tst_qsslsocket - unknown status
43
613}-
614-
615/*!-
616 Returns this connection's CA certificate database. The CA certificate-
617 database is used by the socket during the handshake phase to-
618 validate the peer's certificate. It can be modified prior to the-
619 handshake with setCaCertificates(), or with \l{QSslSocket}'s-
620 \l{QSslSocket::}{addCaCertificate()} and-
621 \l{QSslSocket::}{addCaCertificates()}.-
622-
623 \sa setCaCertificates()-
624*/-
625QList<QSslCertificate> QSslConfiguration::caCertificates() const-
626{-
627 return d->caCertificates;
executed 602 times by 8 tests: return d->caCertificates;
Executed by:
  • tst_NetworkSelfTest
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
602
628}-
629-
630/*!-
631 Sets this socket's CA certificate database to be \a certificates.-
632 The certificate database must be set prior to the SSL handshake.-
633 The CA certificate database is used by the socket during the-
634 handshake phase to validate the peer's certificate.-
635-
636 \sa caCertificates()-
637*/-
638void QSslConfiguration::setCaCertificates(const QList<QSslCertificate> &certificates)-
639{-
640 d->caCertificates = certificates;-
641 d->allowRootCertOnDemandLoading = false;-
642}
executed 42 times by 2 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_qsslsocket - unknown status
42
643-
644/*!-
645 \since 5.5-
646-
647 This function provides the CA certificate database-
648 provided by the operating system. The CA certificate database-
649 returned by this function is used to initialize the database-
650 returned by caCertificates() on the default QSslConfiguration.-
651-
652 \sa caCertificates(), setCaCertificates(), defaultConfiguration()-
653*/-
654QList<QSslCertificate> QSslConfiguration::systemCaCertificates()-
655{-
656 // we are calling ensureInitialized() in the method below-
657 return QSslSocketPrivate::systemCaCertificates();
never executed: return QSslSocketPrivate::systemCaCertificates();
0
658}-
659-
660/*!-
661 Enables or disables an SSL compatibility \a option. If \a on-
662 is true, the \a option is enabled. If \a on is false, the-
663 \a option is disabled.-
664-
665 \sa testSslOption()-
666*/-
667void QSslConfiguration::setSslOption(QSsl::SslOption option, bool on)-
668{-
669 d->sslOptions.setFlag(option, on);-
670}
executed 3 times by 2 tests: end of block
Executed by:
  • tst_QNetworkReply
  • tst_qsslsocket - unknown status
3
671-
672/*!-
673 \since 4.8-
674-
675 Returns \c true if the specified SSL compatibility \a option is enabled.-
676-
677 \sa setSslOption()-
678*/-
679bool QSslConfiguration::testSslOption(QSsl::SslOption option) const-
680{-
681 return d->sslOptions & option;
executed 334 times by 7 tests: return d->sslOptions & option;
Executed by:
  • tst_NetworkSelfTest
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
334
682}-
683-
684/*!-
685 \since 5.2-
686-
687 If QSsl::SslOptionDisableSessionPersistence was turned off, this-
688 function returns the session ticket used in the SSL handshake in ASN.1-
689 format, suitable to e.g. be persisted to disk. If no session ticket was-
690 used or QSsl::SslOptionDisableSessionPersistence was not turned off,-
691 this function returns an empty QByteArray.-
692-
693 \note When persisting the session ticket to disk or similar, be-
694 careful not to expose the session to a potential attacker, as-
695 knowledge of the session allows for eavesdropping on data-
696 encrypted with the session parameters.-
697-
698 \sa setSessionTicket(), QSsl::SslOptionDisableSessionPersistence, setSslOption()-
699 */-
700QByteArray QSslConfiguration::sessionTicket() const-
701{-
702 return d->sslSession;
executed 592 times by 7 tests: return d->sslSession;
Executed by:
  • tst_NetworkSelfTest
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
592
703}-
704-
705/*!-
706 \since 5.2-
707-
708 Sets the session ticket to be used in an SSL handshake.-
709 QSsl::SslOptionDisableSessionPersistence must be turned off-
710 for this to work, and \a sessionTicket must be in ASN.1 format-
711 as returned by sessionTicket().-
712-
713 \sa sessionTicket(), QSsl::SslOptionDisableSessionPersistence, setSslOption()-
714 */-
715void QSslConfiguration::setSessionTicket(const QByteArray &sessionTicket)-
716{-
717 d->sslSession = sessionTicket;-
718}
executed 1 time by 1 test: end of block
Executed by:
  • tst_QNetworkReply
1
719-
720/*!-
721 \since 5.2-
722-
723 If QSsl::SslOptionDisableSessionPersistence was turned off, this-
724 function returns the session ticket life time hint sent by the-
725 server (which might be 0).-
726 If the server did not send a session ticket (e.g. when-
727 resuming a session or when the server does not support it) or-
728 QSsl::SslOptionDisableSessionPersistence was not turned off,-
729 this function returns -1.-
730-
731 \sa sessionTicket(), QSsl::SslOptionDisableSessionPersistence, setSslOption()-
732 */-
733int QSslConfiguration::sessionTicketLifeTimeHint() const-
734{-
735 return d->sslSessionTicketLifeTimeHint;
executed 141 times by 4 tests: return d->sslSessionTicketLifeTimeHint;
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
141
736}-
737-
738/*!-
739 \since 5.7-
740-
741 Returns the ephemeral server key used for cipher algorithms-
742 with forward secrecy, e.g. DHE-RSA-AES128-SHA.-
743-
744 The ephemeral key is only available when running in client mode, i.e.-
745 QSslSocket::SslClientMode. When running in server mode or using a-
746 cipher algorithm without forward secrecy a null key is returned.-
747 The ephemeral server key will be set before emitting the encrypted()-
748 signal.-
749 */-
750QSslKey QSslConfiguration::ephemeralServerKey() const-
751{-
752 return d->ephemeralServerKey;
executed 4 times by 1 test: return d->ephemeralServerKey;
Executed by:
  • tst_qsslsocket - unknown status
4
753}-
754-
755/*!-
756 \since 5.5-
757-
758 Returns this connection's current list of elliptic curves. This-
759 list is used during the handshake phase for choosing an-
760 elliptic curve (when using an elliptic curve cipher).-
761 The returned list of curves is ordered by descending preference-
762 (i.e., the first curve in the list is the most preferred one).-
763-
764 By default, the handshake phase can choose any of the curves-
765 supported by this system's SSL libraries, which may vary from-
766 system to system. The list of curves supported by this system's-
767 SSL libraries is returned by QSslSocket::supportedEllipticCurves().-
768-
769 You can restrict the list of curves used for choosing the session cipher-
770 for this socket by calling setEllipticCurves() with a subset of the-
771 supported ciphers. You can revert to using the entire set by calling-
772 setEllipticCurves() with the list returned by-
773 QSslSocket::supportedEllipticCurves().-
774-
775 \sa setEllipticCurves-
776 */-
777QVector<QSslEllipticCurve> QSslConfiguration::ellipticCurves() const-
778{-
779 return d->ellipticCurves;
executed 589 times by 7 tests: return d->ellipticCurves;
Executed by:
  • tst_NetworkSelfTest
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
589
780}-
781-
782/*!-
783 \since 5.5-
784-
785 Sets the list of elliptic curves to be used by this socket to \a curves,-
786 which must contain a subset of the curves in the list returned by-
787 supportedEllipticCurves().-
788-
789 Restricting the elliptic curves must be done before the handshake-
790 phase, where the session cipher is chosen.-
791-
792 \sa ellipticCurves-
793 */-
794void QSslConfiguration::setEllipticCurves(const QVector<QSslEllipticCurve> &curves)-
795{-
796 d->ellipticCurves = curves;-
797}
never executed: end of block
0
798-
799/*!-
800 \since 5.5-
801-
802 Returns the list of elliptic curves supported by this-
803 system. This list is set by the system's SSL libraries and may-
804 vary from system to system.-
805-
806 \sa ellipticCurves(), setEllipticCurves()-
807*/-
808QVector<QSslEllipticCurve> QSslConfiguration::supportedEllipticCurves()-
809{-
810 return QSslSocketPrivate::supportedEllipticCurves();
executed 2 times by 1 test: return QSslSocketPrivate::supportedEllipticCurves();
Executed by:
  • tst_qsslellipticcurve - unknown status
2
811}-
812-
813/*!-
814 \since 5.3-
815-
816 This function returns the protocol negotiated with the server-
817 if the Next Protocol Negotiation (NPN) TLS extension was enabled.-
818 In order for the NPN extension to be enabled, setAllowedNextProtocols()-
819 needs to be called explicitly before connecting to the server.-
820-
821 If no protocol could be negotiated or the extension was not enabled,-
822 this function returns a QByteArray which is null.-
823-
824 \sa setAllowedNextProtocols(), nextProtocolNegotiationStatus()-
825 */-
826QByteArray QSslConfiguration::nextNegotiatedProtocol() const-
827{-
828 return d->nextNegotiatedProtocol;
executed 232 times by 4 tests: return d->nextNegotiatedProtocol;
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
232
829}-
830-
831/*!-
832 \since 5.3-
833-
834 This function sets the allowed \a protocols to be negotiated with the-
835 server through the Next Protocol Negotiation (NPN) TLS extension; each-
836 element in \a protocols must define one allowed protocol.-
837 The function must be called explicitly before connecting to send the NPN-
838 extension in the SSL handshake.-
839 Whether or not the negotiation succeeded can be queried through-
840 nextProtocolNegotiationStatus().-
841-
842 \sa nextNegotiatedProtocol(), nextProtocolNegotiationStatus(), allowedNextProtocols(), QSslConfiguration::NextProtocolSpdy3_0, QSslConfiguration::NextProtocolHttp1_1-
843 */-
844#if QT_VERSION >= QT_VERSION_CHECK(6,0,0)-
845void QSslConfiguration::setAllowedNextProtocols(const QList<QByteArray> &protocols)-
846#else-
847void QSslConfiguration::setAllowedNextProtocols(QList<QByteArray> protocols)-
848#endif-
849{-
850 d->nextAllowedProtocols = protocols;-
851}
executed 112 times by 1 test: end of block
Executed by:
  • tst_Spdy
112
852-
853/*!-
854 \since 5.3-
855-
856 This function returns the allowed protocols to be negotiated with the-
857 server through the Next Protocol Negotiation (NPN) TLS extension, as set-
858 by setAllowedNextProtocols().-
859-
860 \sa nextNegotiatedProtocol(), nextProtocolNegotiationStatus(), setAllowedNextProtocols(), QSslConfiguration::NextProtocolSpdy3_0, QSslConfiguration::NextProtocolHttp1_1-
861 */-
862QList<QByteArray> QSslConfiguration::allowedNextProtocols() const-
863{-
864 return d->nextAllowedProtocols;
executed 139 times by 4 tests: return d->nextAllowedProtocols;
Executed by:
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
139
865}-
866-
867/*!-
868 \since 5.3-
869-
870 This function returns the status of the Next Protocol Negotiation (NPN).-
871 If the feature has not been enabled through setAllowedNextProtocols(),-
872 this function returns NextProtocolNegotiationNone.-
873 The status will be set before emitting the encrypted() signal.-
874-
875 \sa setAllowedNextProtocols(), allowedNextProtocols(), nextNegotiatedProtocol(), QSslConfiguration::NextProtocolNegotiationStatus-
876 */-
877QSslConfiguration::NextProtocolNegotiationStatus QSslConfiguration::nextProtocolNegotiationStatus() const-
878{-
879 return d->nextProtocolNegotiationStatus;
executed 317 times by 5 tests: return d->nextProtocolNegotiationStatus;
Executed by:
  • tst_QHttpNetworkConnection
  • tst_QNetworkReply
  • tst_Spdy
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_member - unknown status
317
880}-
881-
882/*!-
883 Returns the default SSL configuration to be used in new SSL-
884 connections.-
885-
886 The default SSL configuration consists of:-
887-
888 \list-
889 \li no local certificate and no private key-
890 \li protocol SecureProtocols (meaning either TLS 1.0 or SSL 3 will be used)-
891 \li the system's default CA certificate list-
892 \li the cipher list equal to the list of the SSL libraries'-
893 supported SSL ciphers that are 128 bits or more-
894 \endlist-
895-
896 \sa QSslSocket::supportedCiphers(), setDefaultConfiguration()-
897*/-
898QSslConfiguration QSslConfiguration::defaultConfiguration()-
899{-
900 return QSslConfigurationPrivate::defaultConfiguration();
executed 1003 times by 11 tests: return QSslConfigurationPrivate::defaultConfiguration();
Executed by:
  • tst_QAbstractNetworkCache
  • tst_QHttpNetworkConnection
  • tst_QNetworkAccessManager_And_QProgressDialog
  • tst_QNetworkDiskCache
  • tst_QNetworkProxyFactory
  • tst_QNetworkReply
  • tst_QXmlInputSource
  • tst_Spdy
  • tst_qsslcertificate - unknown status
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
1003
901}-
902-
903/*!-
904 Sets the default SSL configuration to be used in new SSL-
905 connections to be \a configuration. Existing connections are not-
906 affected by this call.-
907-
908 \sa QSslSocket::supportedCiphers(), defaultConfiguration()-
909*/-
910void QSslConfiguration::setDefaultConfiguration(const QSslConfiguration &configuration)-
911{-
912 QSslConfigurationPrivate::setDefaultConfiguration(configuration);-
913}
executed 16 times by 2 tests: end of block
Executed by:
  • tst_qsslsocket - unknown status
  • tst_qsslsocket_onDemandCertificates_static - unknown status
16
914-
915/*! \internal-
916*/-
917bool QSslConfigurationPrivate::peerSessionWasShared(const QSslConfiguration &configuration) {-
918 return configuration.d->peerSessionShared;
executed 14 times by 1 test: return configuration.d->peerSessionShared;
Executed by:
  • tst_QNetworkReply
14
919 }-
920-
921QT_END_NAMESPACE-
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial 4.3.0-BETA-master-30-08-2018-4cb69e9