summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorLiang Qi <liang.qi@theqtcompany.com>2015-06-26 16:20:21 +0200
committerLiang Qi <liang.qi@theqtcompany.com>2015-06-27 13:54:35 +0200
commit4dd8a63fc13cee365c58ef67fa4a4503aeceebe8 (patch)
treec34de00e0bceeb70ed006e06a7fefc21537c72a1 /src/network
parent5757b8c516ad0d613739b222687583bca914a981 (diff)
parentfae33bfbe35f8d082b420ee09662ff60634cb355 (diff)
Merge remote-tracking branch 'origin/5.5.0' into 5.5
Conflicts: src/plugins/platforms/cocoa/qcocoafiledialoghelper.h Manually fixed src/testlib/qtestcase.cpp to return the right type. Change-Id: Id1634dbe3d73fefe9431b9f5378846cb187624e4
Diffstat (limited to 'src/network')
-rw-r--r--src/network/socket/qnativesocketengine_winrt.cpp53
-rw-r--r--src/network/socket/qnativesocketengine_winrt_p.h2
-rw-r--r--src/network/ssl/qsslcipher.cpp5
-rw-r--r--src/network/ssl/qsslconfiguration.cpp45
-rw-r--r--src/network/ssl/qsslconfiguration.h3
-rw-r--r--src/network/ssl/qsslpresharedkeyauthenticator.h24
-rw-r--r--src/network/ssl/qsslsocket.cpp178
-rw-r--r--src/network/ssl/qsslsocket.h35
-rw-r--r--src/network/ssl/qsslsocket_openssl.cpp2
-rw-r--r--src/network/ssl/qsslsocket_p.h2
10 files changed, 152 insertions, 197 deletions
diff --git a/src/network/socket/qnativesocketengine_winrt.cpp b/src/network/socket/qnativesocketengine_winrt.cpp
index 5c615034fc..5e58ee3895 100644
--- a/src/network/socket/qnativesocketengine_winrt.cpp
+++ b/src/network/socket/qnativesocketengine_winrt.cpp
@@ -285,11 +285,23 @@ bool QNativeSocketEngine::connectToHostByName(const QString &name, quint16 port)
return false;
}
d->socketState = QAbstractSocket::ConnectingState;
- hr = d->connectOp->put_Completed(Callback<IAsyncActionCompletedHandler>(
- d, &QNativeSocketEnginePrivate::handleConnectToHost).Get());
- Q_ASSERT_SUCCEEDED(hr);
+ hr = QWinRTFunctions::await(d->connectOp);
+ RETURN_FALSE_IF_FAILED("Connection could not be established");
+ bool connectionErrors = false;
+ d->handleConnectionErrors(d->connectOp.Get(), &connectionErrors);
+ if (connectionErrors)
+ return false;
+ d->connectOp.Reset();
+
+ d->socketState = QAbstractSocket::ConnectedState;
+ emit connectionReady();
- return d->socketState == QAbstractSocket::ConnectedState;
+ // Delay the reader so that the SSL socket can upgrade
+ if (d->sslSocket)
+ connect(d->sslSocket, SIGNAL(encrypted()), SLOT(establishRead()));
+ else
+ establishRead();
+ return true;
}
bool QNativeSocketEngine::bind(const QHostAddress &address, quint16 port)
@@ -1104,47 +1116,34 @@ HRESULT QNativeSocketEnginePrivate::handleClientConnection(IStreamSocketListener
return S_OK;
}
-HRESULT QNativeSocketEnginePrivate::handleConnectToHost(IAsyncAction *action, AsyncStatus)
+void QNativeSocketEnginePrivate::handleConnectionErrors(IAsyncAction *connectAction, bool *errorsOccured)
{
- Q_Q(QNativeSocketEngine);
-
- HRESULT hr = action->GetResults();
- if (wasDeleted || !connectOp) // Protect against a late callback
- return S_OK;
-
- connectOp.Reset();
+ bool error = true;
+ HRESULT hr = connectAction->GetResults();
switch (hr) {
case 0x8007274c: // A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond.
setError(QAbstractSocket::NetworkError, ConnectionTimeOutErrorString);
socketState = QAbstractSocket::UnconnectedState;
- return S_OK;
+ break;
case 0x80072751: // A socket operation was attempted to an unreachable host.
setError(QAbstractSocket::HostNotFoundError, HostUnreachableErrorString);
socketState = QAbstractSocket::UnconnectedState;
- return S_OK;
+ break;
case 0x8007274d: // No connection could be made because the target machine actively refused it.
setError(QAbstractSocket::ConnectionRefusedError, ConnectionRefusedErrorString);
socketState = QAbstractSocket::UnconnectedState;
- return S_OK;
+ break;
default:
if (FAILED(hr)) {
setError(QAbstractSocket::UnknownSocketError, UnknownSocketErrorString);
socketState = QAbstractSocket::UnconnectedState;
- return S_OK;
+ } else {
+ error = false;
}
break;
}
-
- socketState = QAbstractSocket::ConnectedState;
- emit q->connectionReady();
-
- // Delay the reader so that the SSL socket can upgrade
- if (sslSocket)
- q->connect(sslSocket, SIGNAL(encrypted()), SLOT(establishRead()));
- else
- q->establishRead();
-
- return S_OK;
+ if (errorsOccured)
+ *errorsOccured = error;
}
HRESULT QNativeSocketEnginePrivate::handleReadyRead(IAsyncBufferOperation *asyncInfo, AsyncStatus status)
diff --git a/src/network/socket/qnativesocketengine_winrt_p.h b/src/network/socket/qnativesocketengine_winrt_p.h
index 42920c96f2..eb032bc977 100644
--- a/src/network/socket/qnativesocketengine_winrt_p.h
+++ b/src/network/socket/qnativesocketengine_winrt_p.h
@@ -216,7 +216,7 @@ private:
ABI::Windows::Networking::Sockets::IDatagramSocketMessageReceivedEventArgs *args);
HRESULT handleClientConnection(ABI::Windows::Networking::Sockets::IStreamSocketListener *tcpListener,
ABI::Windows::Networking::Sockets::IStreamSocketListenerConnectionReceivedEventArgs *args);
- HRESULT handleConnectToHost(ABI::Windows::Foundation::IAsyncAction *, ABI::Windows::Foundation::AsyncStatus);
+ void handleConnectionErrors(ABI::Windows::Foundation::IAsyncAction *connectAction, bool *errorsOccured);
HRESULT handleReadyRead(ABI::Windows::Foundation::IAsyncOperationWithProgress<ABI::Windows::Storage::Streams::IBuffer *, UINT32> *asyncInfo, ABI::Windows::Foundation::AsyncStatus);
};
diff --git a/src/network/ssl/qsslcipher.cpp b/src/network/ssl/qsslcipher.cpp
index 8f2b8b54ad..c480b79371 100644
--- a/src/network/ssl/qsslcipher.cpp
+++ b/src/network/ssl/qsslcipher.cpp
@@ -54,6 +54,7 @@
#include "qsslcipher.h"
#include "qsslcipher_p.h"
#include "qsslsocket.h"
+#include "qsslconfiguration.h"
#ifndef QT_NO_DEBUG_STREAM
#include <QtCore/qdebug.h>
@@ -81,7 +82,7 @@ QSslCipher::QSslCipher()
QSslCipher::QSslCipher(const QString &name)
: d(new QSslCipherPrivate)
{
- foreach (const QSslCipher &cipher, QSslSocket::supportedCiphers()) {
+ foreach (const QSslCipher &cipher, QSslConfiguration::supportedCiphers()) {
if (cipher.name() == name) {
*this = cipher;
return;
@@ -102,7 +103,7 @@ QSslCipher::QSslCipher(const QString &name)
QSslCipher::QSslCipher(const QString &name, QSsl::SslProtocol protocol)
: d(new QSslCipherPrivate)
{
- foreach (const QSslCipher &cipher, QSslSocket::supportedCiphers()) {
+ foreach (const QSslCipher &cipher, QSslConfiguration::supportedCiphers()) {
if (cipher.name() == name && cipher.protocol() == protocol) {
*this = cipher;
return;
diff --git a/src/network/ssl/qsslconfiguration.cpp b/src/network/ssl/qsslconfiguration.cpp
index 5c95c9f544..4803e47224 100644
--- a/src/network/ssl/qsslconfiguration.cpp
+++ b/src/network/ssl/qsslconfiguration.cpp
@@ -36,6 +36,7 @@
#include "qsslconfiguration.h"
#include "qsslconfiguration_p.h"
#include "qsslsocket.h"
+#include "qsslsocket_p.h"
#include "qmutex.h"
#include "qdebug.h"
@@ -590,6 +591,20 @@ void QSslConfiguration::setCiphers(const QList<QSslCipher> &ciphers)
}
/*!
+ \since 5.5
+
+ Returns the list of cryptographic ciphers supported by this
+ system. This list is set by the system's SSL libraries and may
+ vary from system to system.
+
+ \sa ciphers(), setCiphers()
+*/
+QList<QSslCipher> QSslConfiguration::supportedCiphers()
+{
+ return QSslSocketPrivate::supportedCiphers();
+}
+
+/*!
Returns this connection's CA certificate database. The CA certificate
database is used by the socket during the handshake phase to
validate the peer's certificate. It can be modified prior to the
@@ -619,6 +634,22 @@ void QSslConfiguration::setCaCertificates(const QList<QSslCertificate> &certific
}
/*!
+ \since 5.5
+
+ This function provides the CA certificate database
+ provided by the operating system. The CA certificate database
+ returned by this function is used to initialize the database
+ returned by caCertificates() on the default QSslConfiguration.
+
+ \sa caCertificates(), setCaCertificates(), defaultConfiguration()
+*/
+QList<QSslCertificate> QSslConfiguration::systemCaCertificates()
+{
+ // we are calling ensureInitialized() in the method below
+ return QSslSocketPrivate::systemCaCertificates();
+}
+
+/*!
Enables or disables an SSL compatibility \a option. If \a on
is true, the \a option is enabled. If \a on is false, the
\a option is disabled.
@@ -744,6 +775,20 @@ void QSslConfiguration::setEllipticCurves(const QVector<QSslEllipticCurve> &curv
}
/*!
+ \since 5.5
+
+ Returns the list of elliptic curves supported by this
+ system. This list is set by the system's SSL libraries and may
+ vary from system to system.
+
+ \sa ellipticCurves(), setEllipticCurves()
+*/
+QVector<QSslEllipticCurve> QSslConfiguration::supportedEllipticCurves()
+{
+ return QSslSocketPrivate::supportedEllipticCurves();
+}
+
+/*!
\since 5.3
This function returns the protocol negotiated with the server
diff --git a/src/network/ssl/qsslconfiguration.h b/src/network/ssl/qsslconfiguration.h
index c5a1c6e6d4..960aec60ce 100644
--- a/src/network/ssl/qsslconfiguration.h
+++ b/src/network/ssl/qsslconfiguration.h
@@ -111,10 +111,12 @@ public:
// Cipher settings
QList<QSslCipher> ciphers() const;
void setCiphers(const QList<QSslCipher> &ciphers);
+ static QList<QSslCipher> supportedCiphers();
// Certificate Authority (CA) settings
QList<QSslCertificate> caCertificates() const;
void setCaCertificates(const QList<QSslCertificate> &certificates);
+ static QList<QSslCertificate> systemCaCertificates();
void setSslOption(QSsl::SslOption option, bool on);
bool testSslOption(QSsl::SslOption option) const;
@@ -126,6 +128,7 @@ public:
// EC settings
QVector<QSslEllipticCurve> ellipticCurves() const;
void setEllipticCurves(const QVector<QSslEllipticCurve> &curves);
+ static QVector<QSslEllipticCurve> supportedEllipticCurves();
static QSslConfiguration defaultConfiguration();
static void setDefaultConfiguration(const QSslConfiguration &configuration);
diff --git a/src/network/ssl/qsslpresharedkeyauthenticator.h b/src/network/ssl/qsslpresharedkeyauthenticator.h
index 52301ef7e5..159b16d563 100644
--- a/src/network/ssl/qsslpresharedkeyauthenticator.h
+++ b/src/network/ssl/qsslpresharedkeyauthenticator.h
@@ -43,13 +43,13 @@ QT_BEGIN_NAMESPACE
class QSslPreSharedKeyAuthenticatorPrivate;
-class Q_NETWORK_EXPORT QSslPreSharedKeyAuthenticator
+class QSslPreSharedKeyAuthenticator
{
public:
- QSslPreSharedKeyAuthenticator();
- ~QSslPreSharedKeyAuthenticator();
- QSslPreSharedKeyAuthenticator(const QSslPreSharedKeyAuthenticator &authenticator);
- QSslPreSharedKeyAuthenticator &operator=(const QSslPreSharedKeyAuthenticator &authenticator);
+ Q_NETWORK_EXPORT QSslPreSharedKeyAuthenticator();
+ Q_NETWORK_EXPORT ~QSslPreSharedKeyAuthenticator();
+ Q_NETWORK_EXPORT QSslPreSharedKeyAuthenticator(const QSslPreSharedKeyAuthenticator &authenticator);
+ Q_NETWORK_EXPORT QSslPreSharedKeyAuthenticator &operator=(const QSslPreSharedKeyAuthenticator &authenticator);
#ifdef Q_COMPILER_RVALUE_REFS
inline QSslPreSharedKeyAuthenticator &operator=(QSslPreSharedKeyAuthenticator &&authenticator)
@@ -61,15 +61,15 @@ public:
d.swap(authenticator.d);
}
- QByteArray identityHint() const;
+ Q_NETWORK_EXPORT QByteArray identityHint() const;
- void setIdentity(const QByteArray &identity);
- QByteArray identity() const;
- int maximumIdentityLength() const;
+ Q_NETWORK_EXPORT void setIdentity(const QByteArray &identity);
+ Q_NETWORK_EXPORT QByteArray identity() const;
+ Q_NETWORK_EXPORT int maximumIdentityLength() const;
- void setPreSharedKey(const QByteArray &preSharedKey);
- QByteArray preSharedKey() const;
- int maximumPreSharedKeyLength() const;
+ Q_NETWORK_EXPORT void setPreSharedKey(const QByteArray &preSharedKey);
+ Q_NETWORK_EXPORT QByteArray preSharedKey() const;
+ Q_NETWORK_EXPORT int maximumPreSharedKeyLength() const;
private:
friend Q_NETWORK_EXPORT bool operator==(const QSslPreSharedKeyAuthenticator &lhs, const QSslPreSharedKeyAuthenticator &rhs);
diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp
index 513cc51620..07c0cd4bf8 100644
--- a/src/network/ssl/qsslsocket.cpp
+++ b/src/network/ssl/qsslsocket.cpp
@@ -1166,6 +1166,10 @@ QSslKey QSslSocket::privateKey() const
}
/*!
+ \deprecated
+
+ Use QSslConfiguration::ciphers() instead.
+
Returns this socket's current cryptographic cipher suite. This
list is used during the socket's handshake phase for choosing a
session cipher. The returned list of ciphers is ordered by
@@ -1197,6 +1201,10 @@ QList<QSslCipher> QSslSocket::ciphers() const
}
/*!
+ \deprecated
+
+ USe QSslConfiguration::setCiphers() instead.
+
Sets the cryptographic cipher suite for this socket to \a ciphers,
which must contain a subset of the ciphers in the list returned by
supportedCiphers().
@@ -1213,6 +1221,10 @@ void QSslSocket::setCiphers(const QList<QSslCipher> &ciphers)
}
/*!
+ \deprecated
+
+ Use QSslConfiguration::setCiphers() instead.
+
Sets the cryptographic cipher suite for this socket to \a ciphers, which
is a colon-separated list of cipher suite names. The ciphers are listed in
order of preference, starting with the most preferred cipher. For example:
@@ -1238,6 +1250,10 @@ void QSslSocket::setCiphers(const QString &ciphers)
}
/*!
+ \deprecated
+
+ Use QSslConfiguration::setCiphers() on the default QSslConfiguration instead.
+
Sets the default cryptographic cipher suite for all sockets in
this application to \a ciphers, which must contain a subset of the
ciphers in the list returned by supportedCiphers().
@@ -1254,6 +1270,10 @@ void QSslSocket::setDefaultCiphers(const QList<QSslCipher> &ciphers)
}
/*!
+ \deprecated
+
+ Use QSslConfiguration::ciphers() on the default QSslConfiguration instead.
+
Returns the default cryptographic cipher suite for all sockets in
this application. This list is used during the socket's handshake
phase when negotiating with the peer to choose a session cipher.
@@ -1273,6 +1293,10 @@ QList<QSslCipher> QSslSocket::defaultCiphers()
}
/*!
+ \deprecated
+
+ Use QSslConfiguration::supportedCiphers() instead.
+
Returns the list of cryptographic ciphers supported by this
system. This list is set by the system's SSL libraries and may
vary from system to system.
@@ -1285,120 +1309,6 @@ QList<QSslCipher> QSslSocket::supportedCiphers()
}
/*!
- \since 5.5
-
- Returns this socket's current list of elliptic curves. This
- list is used during the socket's handshake phase for choosing an
- elliptic curve (when using an elliptic curve cipher).
- The returned list of curves is ordered by descending preference
- (i.e., the first curve in the list is the most preferred one).
-
- By default, this list is empty. An empty default list means that the
- handshake phase can choose any of the curves supported by this system's SSL
- libraries (which may vary from system to system). The list of curves
- supported by this system's SSL libraries is returned by
- supportedEllipticCurves().
-
- You can restrict the list of curves used for choosing the session cipher
- for this socket by calling setEllipticCurves() with a subset of the
- supported ciphers. You can revert to using the entire set by calling
- setEllipticCurves() with the list returned by supportedEllipticCurves().
-
- \sa setEllipticCurves(), defaultEllipticCurves(), setDefaultEllipticCurves(), supportedEllipticCurves()
-*/
-QVector<QSslEllipticCurve> QSslSocket::ellipticCurves() const
-{
- Q_D(const QSslSocket);
- return d->configuration.ellipticCurves;
-}
-
-/*!
- \since 5.5
-
- Sets the list of elliptic curves to be used by this socket to \a curves,
- which must contain a subset of the curves in the list returned by
- supportedEllipticCurves().
-
- Restricting the elliptic curves must be done before the handshake
- phase, where the session cipher is chosen.
-
- If an empty list is set, then the handshake phase can choose any of the
- curves supported by this system's SSL libraries (which may vary from system
- to system). The list of curves supported by this system's SSL libraries is
- returned by supportedEllipticCurves().
-
- Use setCipher() in order to disable the usage of elliptic curve ciphers.
-
- \sa ellipticCurves(), setDefaultEllipticCurves(), supportedEllipticCurves()
-*/
-void QSslSocket::setEllipticCurves(const QVector<QSslEllipticCurve> &curves)
-{
- Q_D(QSslSocket);
- d->configuration.ellipticCurves = curves;
-}
-
-/*!
- \since 5.5
-
- Sets the list of elliptic curves to be used by all sockets in this
- application to \a curves, which must contain a subset of the curves in the
- list returned by supportedEllipticCurves().
-
- Restricting the default elliptic curves only affects SSL sockets
- that perform their handshake phase after the default list has been changed.
-
- If an empty list is set, then the handshake phase can choose any of the
- curves supported by this system's SSL libraries (which may vary from system
- to system). The list of curves supported by this system's SSL libraries is
- returned by supportedEllipticCurves().
-
- Use setDefaultCiphers() in order to disable the usage of elliptic curve ciphers.
-
- \sa setEllipticCurves(), defaultEllipticCurves(), supportedEllipticCurves()
-*/
-void QSslSocket::setDefaultEllipticCurves(const QVector<QSslEllipticCurve> &curves)
-{
- QSslSocketPrivate::setDefaultEllipticCurves(curves);
-}
-
-
-/*!
- \since 5.5
-
- Returns the default elliptic curves list for all sockets in
- this application. This list is used during the socket's handshake
- phase when negotiating with the peer to choose a session cipher.
- The list is ordered by preference (i.e., the first curve in the
- list is the most preferred one).
-
- By default, this list is empty. An empty default list means that the
- handshake phase can choose any of the curves supported by this system's SSL
- libraries (which may vary from system to system). The list of curves
- supported by this system's SSL libraries is returned by
- supportedEllipticCurves().
-
- \sa setDefaultEllipticCurves(), supportedEllipticCurves()
-*/
-QVector<QSslEllipticCurve> QSslSocket::defaultEllipticCurves()
-{
- return QSslSocketPrivate::defaultEllipticCurves();
-}
-
-/*!
- \since 5.5
-
- Returns the list of elliptic curves supported by this
- system. This list is set by the system's SSL libraries and may
- vary from system to system.
-
- \sa ellipticCurves(), setEllipticCurves(), defaultEllipticCurves()
-*/
-QVector<QSslEllipticCurve> QSslSocket::supportedEllipticCurves()
-{
- return QSslSocketPrivate::supportedEllipticCurves();
-}
-
-/*!
Searches all files in the \a path for certificates encoded in the
specified \a format and adds them to this socket's CA certificate
database. \a path can be explicit, or it can contain wildcards in
@@ -1456,6 +1366,10 @@ void QSslSocket::addCaCertificates(const QList<QSslCertificate> &certificates)
}
/*!
+ \deprecated
+
+ Use QSslConfiguration::setCaCertificates() instead.
+
Sets this socket's CA certificate database to be \a certificates.
The certificate database must be set prior to the SSL handshake.
The CA certificate database is used by the socket during the
@@ -1475,6 +1389,10 @@ void QSslSocket::setCaCertificates(const QList<QSslCertificate> &certificates)
}
/*!
+ \deprecated
+
+ Use QSslConfiguration::caCertificates() instead.
+
Returns this socket's CA certificate database. The CA certificate
database is used by the socket during the handshake phase to
validate the peer's certificate. It can be moodified prior to the
@@ -1535,6 +1453,10 @@ void QSslSocket::addDefaultCaCertificates(const QList<QSslCertificate> &certific
}
/*!
+ \deprecated
+
+ Use QSslConfiguration::setCaCertificates() on the default QSslConfiguration instead.
+
Sets the default CA certificate database to \a certificates. The
default CA certificate database is originally set to your system's
default CA certificate database. You can override the default CA
@@ -1552,6 +1474,10 @@ void QSslSocket::setDefaultCaCertificates(const QList<QSslCertificate> &certific
}
/*!
+ \deprecated
+
+ Use QSslConfiguration::caCertificates() on the default QSslConfiguration instead.
+
Returns the current default CA certificate database. This database
is originally set to your system's default CA certificate database.
If no system default database is found, an empty database will be
@@ -1572,6 +1498,10 @@ QList<QSslCertificate> QSslSocket::defaultCaCertificates()
}
/*!
+ \deprecated
+
+ Use QSslConfiguration::systemDefaultCaCertificates instead.
+
This function provides the CA certificate database
provided by the operating system. The CA certificate database
returned by this function is used to initialize the database
@@ -2166,16 +2096,6 @@ void QSslSocketPrivate::setDefaultSupportedCiphers(const QList<QSslCipher> &ciph
/*!
\internal
*/
-QVector<QSslEllipticCurve> QSslSocketPrivate::defaultEllipticCurves()
-{
- QSslSocketPrivate::ensureInitialized();
- const QMutexLocker locker(&globalData()->mutex);
- return globalData()->config->ellipticCurves;
-}
-
-/*!
- \internal
-*/
QVector<QSslEllipticCurve> QSslSocketPrivate::supportedEllipticCurves()
{
QSslSocketPrivate::ensureInitialized();
@@ -2186,16 +2106,6 @@ QVector<QSslEllipticCurve> QSslSocketPrivate::supportedEllipticCurves()
/*!
\internal
*/
-void QSslSocketPrivate::setDefaultEllipticCurves(const QVector<QSslEllipticCurve> &curves)
-{
- const QMutexLocker locker(&globalData()->mutex);
- globalData()->config.detach();
- globalData()->config->ellipticCurves = curves;
-}
-
-/*!
- \internal
-*/
void QSslSocketPrivate::setDefaultSupportedEllipticCurves(const QVector<QSslEllipticCurve> &curves)
{
const QMutexLocker locker(&globalData()->mutex);
diff --git a/src/network/ssl/qsslsocket.h b/src/network/ssl/qsslsocket.h
index 8ad6d033a7..4124f5b7e5 100644
--- a/src/network/ssl/qsslsocket.h
+++ b/src/network/ssl/qsslsocket.h
@@ -144,34 +144,33 @@ public:
QSslKey privateKey() const;
// Cipher settings.
- QList<QSslCipher> ciphers() const;
- void setCiphers(const QList<QSslCipher> &ciphers);
- void setCiphers(const QString &ciphers);
- static void setDefaultCiphers(const QList<QSslCipher> &ciphers);
- static QList<QSslCipher> defaultCiphers();
- static QList<QSslCipher> supportedCiphers();
-
- // EC settings.
- QVector<QSslEllipticCurve> ellipticCurves() const;
- void setEllipticCurves(const QVector<QSslEllipticCurve> &curves);
- static void setDefaultEllipticCurves(const QVector<QSslEllipticCurve> &curves);
- static QVector<QSslEllipticCurve> defaultEllipticCurves();
- static QVector<QSslEllipticCurve> supportedEllipticCurves();
+#if QT_DEPRECATED_SINCE(5, 5)
+ QT_DEPRECATED_X("Use QSslConfiguration::ciphers()") QList<QSslCipher> ciphers() const;
+ QT_DEPRECATED_X("Use QSslConfiguration::setCiphers()") void setCiphers(const QList<QSslCipher> &ciphers);
+ QT_DEPRECATED void setCiphers(const QString &ciphers);
+ QT_DEPRECATED static void setDefaultCiphers(const QList<QSslCipher> &ciphers);
+ QT_DEPRECATED static QList<QSslCipher> defaultCiphers();
+ QT_DEPRECATED_X("Use QSslConfiguration::supportedCiphers()") static QList<QSslCipher> supportedCiphers();
+#endif // QT_DEPRECATED_SINCE(5, 5)
// CA settings.
bool addCaCertificates(const QString &path, QSsl::EncodingFormat format = QSsl::Pem,
QRegExp::PatternSyntax syntax = QRegExp::FixedString);
void addCaCertificate(const QSslCertificate &certificate);
void addCaCertificates(const QList<QSslCertificate> &certificates);
- void setCaCertificates(const QList<QSslCertificate> &certificates);
- QList<QSslCertificate> caCertificates() const;
+#if QT_DEPRECATED_SINCE(5, 5)
+ QT_DEPRECATED_X("Use QSslConfiguration::setCaCertificates()") void setCaCertificates(const QList<QSslCertificate> &certificates);
+ QT_DEPRECATED_X("Use QSslConfiguration::caCertificates()") QList<QSslCertificate> caCertificates() const;
+#endif // QT_DEPRECATED_SINCE(5, 5)
static bool addDefaultCaCertificates(const QString &path, QSsl::EncodingFormat format = QSsl::Pem,
QRegExp::PatternSyntax syntax = QRegExp::FixedString);
static void addDefaultCaCertificate(const QSslCertificate &certificate);
static void addDefaultCaCertificates(const QList<QSslCertificate> &certificates);
- static void setDefaultCaCertificates(const QList<QSslCertificate> &certificates);
- static QList<QSslCertificate> defaultCaCertificates();
- static QList<QSslCertificate> systemCaCertificates();
+#if QT_DEPRECATED_SINCE(5, 5)
+ QT_DEPRECATED static void setDefaultCaCertificates(const QList<QSslCertificate> &certificates);
+ QT_DEPRECATED static QList<QSslCertificate> defaultCaCertificates();
+ QT_DEPRECATED_X("Use QSslConfiguration::systemCaCertificates()") static QList<QSslCertificate> systemCaCertificates();
+#endif // QT_DEPRECATED_SINCE(5, 5)
bool waitForConnected(int msecs = 30000) Q_DECL_OVERRIDE;
bool waitForEncrypted(int msecs = 30000);
diff --git a/src/network/ssl/qsslsocket_openssl.cpp b/src/network/ssl/qsslsocket_openssl.cpp
index 19848a73f0..049666b70b 100644
--- a/src/network/ssl/qsslsocket_openssl.cpp
+++ b/src/network/ssl/qsslsocket_openssl.cpp
@@ -1685,7 +1685,7 @@ QList<QSslError> QSslSocketBackendPrivate::verify(const QList<QSslCertificate> &
setDefaultCaCertificates(defaultCaCertificates() + systemCaCertificates());
}
- foreach (const QSslCertificate &caCertificate, QSslSocket::defaultCaCertificates()) {
+ foreach (const QSslCertificate &caCertificate, QSslConfiguration::defaultConfiguration().caCertificates()) {
// From https://www.openssl.org/docs/ssl/SSL_CTX_load_verify_locations.html:
//
// If several CA certificates matching the name, key identifier, and
diff --git a/src/network/ssl/qsslsocket_p.h b/src/network/ssl/qsslsocket_p.h
index 5f726f2371..d6519718d9 100644
--- a/src/network/ssl/qsslsocket_p.h
+++ b/src/network/ssl/qsslsocket_p.h
@@ -137,9 +137,7 @@ public:
static void setDefaultSupportedCiphers(const QList<QSslCipher> &ciphers);
static void resetDefaultCiphers();
- static QVector<QSslEllipticCurve> defaultEllipticCurves();
static QVector<QSslEllipticCurve> supportedEllipticCurves();
- static void setDefaultEllipticCurves(const QVector<QSslEllipticCurve> &curves);
static void setDefaultSupportedEllipticCurves(const QVector<QSslEllipticCurve> &curves);
static void resetDefaultEllipticCurves();