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