30 #include <QTestEventLoop>
32 #include <QtNetwork/qsslpresharedkeyauthenticator.h>
33 #include <QtNetwork/qsslconfiguration.h>
34 #include <QtNetwork/qhostaddress.h>
35 #include <QtNetwork/qsslsocket.h>
36 #include <QtNetwork/qsslcipher.h>
37 #include <QtNetwork/qudpsocket.h>
38 #include <QtNetwork/qsslerror.h>
39 #include <QtNetwork/qsslkey.h>
40 #include <QtNetwork/qdtls.h>
41 #include <QtNetwork/qssl.h>
43 #include <QtCore/qcryptographichash.h>
44 #include <QtCore/qscopeguard.h>
45 #include <QtCore/qbytearray.h>
46 #include <QtCore/qobject.h>
47 #include <QtCore/qstring.h>
48 #include <QtCore/qlist.h>
50 #include "../shared/tlshelpers.h"
73 #define QDTLS_VERIFY_NO_ERROR(obj) QVERIFY(dtlsErrorIsCleared(obj))
75 #define QDTLS_VERIFY_HANDSHAKE_SUCCESS(obj) \
76 QVERIFY(obj->isConnectionEncrypted()); \
77 QCOMPARE(obj->handshakeState(), QDtls::HandshakeComplete); \
78 QDTLS_VERIFY_NO_ERROR(obj); \
79 QCOMPARE(obj->peerVerificationErrors().size(), 0)
91 void construction_data();
93 void configuration_data();
95 void invalidConfiguration();
98 void handshake_data();
100 void handshakeWithRetransmission();
101 void sessionCipher();
102 void cipherPreferences_data();
103 void cipherPreferences();
104 void protocolVersionMatching_data();
105 void protocolVersionMatching();
106 void verificationErrors_data();
107 void verificationErrors();
108 void presetExpectedErrors_data();
109 void presetExpectedErrors();
110 void verifyServerCertificate_data();
111 void verifyServerCertificate();
112 void verifyClientCertificate_data();
113 void verifyClientCertificate();
114 void blacklistedCerificate();
115 void readWriteEncrypted_data();
116 void readWriteEncrypted();
117 void datagramFragmentation();
126 void clientServerData();
127 void connectHandshakeReadingSlots();
128 void connectEncryptedReadingSlots();
140 bool serverDropDgram =
false;
141 const QByteArray serverExpectedPlainText =
"Hello W ... hmm, I mean DTLS server!";
147 bool clientDropDgram =
false;
148 const QByteArray clientExpectedPlainText =
"Hello DTLS client.";
155 const int handshakeTimeoutMS = 5000;
156 const int dataExchangeTimeoutMS = 1000;
158 const QByteArray presharedKey =
"DEADBEEFDEADBEEF";
177 QSKIP(
"The active TLS backend does not support DTLS");
193 selfSignedCert = certificates.
first();
195 defaultServerConfig = QSslConfiguration::defaultDtlsConfiguration();
197 defaultServerConfig.setDtlsCookieVerificationEnabled(
false);
207 serverSocket.
close();
217 clientSocket.
close();
226 serverDropDgram =
false;
227 serverReceivedPlainText.
clear();
230 clientDropDgram =
false;
231 clientReceivedPlainText.
clear();
239 void tst_QDtls::construction_data()
244 void tst_QDtls::construction()
258 #ifdef QT_CRYPTOGRAPHICHASH_ONLY_SHA1
276 void tst_QDtls::configuration_data()
281 void tst_QDtls::configuration()
285 auto config = QSslConfiguration::defaultDtlsConfiguration();
290 for (
const auto &cipher : ciphers)
291 QVERIFY(cipher.usedBits() >= 128);
298 config.setProtocol(QSsl::DtlsV1_0OrLater);
299 config.setDtlsCookieVerificationEnabled(
false);
323 static bool doneAlready =
false;
327 const auto defaultDtlsConfig = QSslConfiguration::defaultDtlsConfiguration();
328 const auto restoreDefault =
qScopeGuard([&defaultDtlsConfig] {
329 QSslConfiguration::setDefaultDtlsConfiguration(defaultDtlsConfig);
331 QSslConfiguration::setDefaultDtlsConfiguration(nullConfig);
332 QCOMPARE(QSslConfiguration::defaultDtlsConfiguration(), nullConfig);
333 QVERIFY(QSslConfiguration::defaultDtlsConfiguration() != defaultDtlsConfig);
337 void tst_QDtls::invalidConfiguration()
341 QVERIFY(crypto.setPeer(serverAddress, serverPort));
351 void tst_QDtls::setPeer_data()
356 void tst_QDtls::setPeer()
366 for (
const auto &
addr : invalid) {
392 void tst_QDtls::handshake_data()
394 QTest::addColumn<bool>(
"withCertificate");
400 void tst_QDtls::handshake()
402 connectHandshakeReadingSlots();
404 QFETCH(
const bool, withCertificate);
406 auto serverConfig = defaultServerConfig;
407 auto clientConfig = QSslConfiguration::defaultDtlsConfiguration();
409 if (!withCertificate) {
413 QVERIFY(clientConfig.peerCertificate().isNull());
415 serverConfig.setPrivateKey(serverKeySS);
416 serverConfig.setLocalCertificate(selfSignedCert);
417 clientConfig.setCaCertificates({selfSignedCert});
420 QVERIFY(serverCrypto->setDtlsConfiguration(serverConfig));
421 QVERIFY(clientCrypto->setDtlsConfiguration(clientConfig));
425 QVERIFY(!clientCrypto->doHandshake(&clientSocket));
430 QVERIFY(clientCrypto->setPeer(serverAddress, serverPort, hostName));
433 QVERIFY(!clientCrypto->doHandshake(
nullptr));
437 QVERIFY(clientCrypto->doHandshake(&clientSocket));
445 QVERIFY(serverCrypto->isConnectionEncrypted());
448 QCOMPARE(serverCrypto->peerVerificationErrors().size(), 0);
450 QVERIFY(clientCrypto->isConnectionEncrypted());
453 QCOMPARE(clientCrypto->peerVerificationErrors().size(), 0);
455 if (withCertificate) {
456 const auto serverCert = clientCrypto->dtlsConfiguration().peerCertificate();
458 QCOMPARE(serverCert, selfSignedCert);
462 QVERIFY(!clientCrypto->doHandshake(&clientSocket));
464 QVERIFY(!serverCrypto->doHandshake(&serverSocket, {
"ServerHello"}));
467 QVERIFY(!clientCrypto->setPeer(serverAddress, serverPort));
469 QVERIFY(!serverCrypto->setPeer(clientAddress, clientPort));
473 void tst_QDtls::handshakeWithRetransmission()
475 connectHandshakeReadingSlots();
477 auto serverConfig = defaultServerConfig;
479 serverConfig.setLocalCertificate(selfSignedCert);
480 QVERIFY(serverCrypto->setDtlsConfiguration(serverConfig));
482 auto clientConfig = QSslConfiguration::defaultDtlsConfiguration();
483 clientConfig.setCaCertificates({selfSignedCert});
484 QVERIFY(clientCrypto->setDtlsConfiguration(clientConfig));
485 QVERIFY(clientCrypto->setPeer(serverAddress, serverPort, hostName));
488 QVERIFY(clientCrypto->doHandshake(&clientSocket));
492 serverDropDgram =
true;
493 clientDropDgram =
true;
508 void tst_QDtls::sessionCipher()
510 connectHandshakeReadingSlots();
512 auto serverConfig = defaultServerConfig;
514 serverConfig.setLocalCertificate(selfSignedCert);
515 QVERIFY(serverCrypto->setDtlsConfiguration(serverConfig));
517 auto clientConfig = QSslConfiguration::defaultDtlsConfiguration();
518 clientConfig.setCaCertificates({selfSignedCert});
519 QVERIFY(clientCrypto->setDtlsConfiguration(clientConfig));
521 QVERIFY(clientCrypto->setPeer(serverAddress, serverPort, hostName));
522 QVERIFY(clientCrypto->doHandshake(&clientSocket));
530 const auto defaultDtlsConfig = QSslConfiguration::defaultDtlsConfiguration();
532 const auto clCipher = clientCrypto->sessionCipher();
534 QVERIFY(defaultDtlsConfig.ciphers().contains(clCipher));
536 const auto srvCipher = serverCrypto->sessionCipher();
538 QVERIFY(defaultDtlsConfig.ciphers().contains(srvCipher));
543 void tst_QDtls::cipherPreferences_data()
545 QTest::addColumn<bool>(
"preferClient");
551 void tst_QDtls::cipherPreferences()
559 auto serverConfig = defaultServerConfig;
562 QSKIP(
"The ciphers needed by this test were not found in the default DTLS configuration");
564 serverConfig.setCiphers({aes128, aes256});
565 serverConfig.setLocalCertificate(selfSignedCert);
566 serverConfig.setPrivateKey(serverKeySS);
568 QFETCH(
const bool, preferClient);
572 QVERIFY(serverCrypto->setDtlsConfiguration(serverConfig));
575 auto clientConfig = QSslConfiguration::defaultDtlsConfiguration();
577 clientConfig.setCiphers({aes256, aes128});
578 QVERIFY(clientCrypto->setDtlsConfiguration(clientConfig));
579 QVERIFY(clientCrypto->setPeer(serverAddress, serverPort));
582 connectHandshakeReadingSlots();
584 QVERIFY(clientCrypto->doHandshake(&clientSocket));
593 QCOMPARE(clientCrypto->sessionCipher(), aes256);
594 QCOMPARE(serverCrypto->sessionCipher(), aes256);
596 QCOMPARE(clientCrypto->sessionCipher(), aes128);
597 QCOMPARE(serverCrypto->sessionCipher(), aes128);
601 void tst_QDtls::protocolVersionMatching_data()
603 QTest::addColumn<QSsl::SslProtocol>(
"serverProtocol");
604 QTest::addColumn<QSsl::SslProtocol>(
"clientProtocol");
605 QTest::addColumn<bool>(
"works");
607 QTest::addRow(
"DtlsV1_0 <-> DtlsV1_0") << QSsl::DtlsV1_0 << QSsl::DtlsV1_0 <<
true;
608 QTest::addRow(
"DtlsV1_0OrLater <-> DtlsV1_0") << QSsl::DtlsV1_0OrLater << QSsl::DtlsV1_0 <<
true;
609 QTest::addRow(
"DtlsV1_0 <-> DtlsV1_0OrLater") << QSsl::DtlsV1_0 << QSsl::DtlsV1_0OrLater <<
true;
610 QTest::addRow(
"DtlsV1_0OrLater <-> DtlsV1_0OrLater") << QSsl::DtlsV1_0OrLater << QSsl::DtlsV1_0OrLater <<
true;
623 void tst_QDtls::protocolVersionMatching()
627 QFETCH(
const bool, works);
629 connectHandshakeReadingSlots();
634 auto serverConfig = defaultServerConfig;
636 QVERIFY(serverCrypto->setDtlsConfiguration(serverConfig));
638 auto clientConfig = QSslConfiguration::defaultDtlsConfiguration();
640 clientConfig.setProtocol(clientProtocol);
641 QVERIFY(clientCrypto->setDtlsConfiguration(clientConfig));
643 QVERIFY(clientCrypto->setPeer(serverAddress, serverPort));
644 QVERIFY(clientCrypto->doHandshake(&clientSocket));
652 QCOMPARE(serverCrypto->isConnectionEncrypted(),
false);
654 QCOMPARE(clientCrypto->isConnectionEncrypted(),
false);
659 void tst_QDtls::verificationErrors_data()
661 QTest::addColumn<bool>(
"abortHandshake");
667 void tst_QDtls::verificationErrors()
669 connectHandshakeReadingSlots();
671 auto serverConfig = defaultServerConfig;
673 serverConfig.setLocalCertificate(selfSignedCert);
674 QVERIFY(serverCrypto->setDtlsConfiguration(serverConfig));
677 QVERIFY(clientCrypto->setPeer(serverAddress, serverPort));
679 QVERIFY(clientCrypto->doHandshake(&clientSocket));
688 QVERIFY(!clientCrypto->isConnectionEncrypted());
693 const auto serverCert = clientCrypto->dtlsConfiguration().peerCertificate();
695 QCOMPARE(selfSignedCert, serverCert);
697 QFETCH(
const bool, abortHandshake);
699 if (abortHandshake) {
700 QVERIFY(!clientCrypto->abortHandshake(
nullptr));
702 QVERIFY(clientCrypto->abortHandshake(&clientSocket));
704 QVERIFY(!clientCrypto->isConnectionEncrypted());
708 const auto config = clientCrypto->dtlsConfiguration();
711 QCOMPARE(clientCrypto->peerVerificationErrors().size(), 0);
713 clientCrypto->ignoreVerificationErrors(clientCrypto->peerVerificationErrors());
714 QVERIFY(!clientCrypto->resumeHandshake(
nullptr));
716 QVERIFY(clientCrypto->resumeHandshake(&clientSocket));
718 QVERIFY(clientCrypto->isConnectionEncrypted());
720 QCOMPARE(clientCrypto->peerVerificationErrors().size(), 0);
724 void tst_QDtls::presetExpectedErrors_data()
726 QTest::addColumn<QList<QSslError>>(
"expectedTlsErrors");
727 QTest::addColumn<bool>(
"works");
730 QTest::addRow(
"unexpected-self-signed") << expectedErrors <<
false;
732 QTest::addRow(
"all-errors-ignored") << expectedErrors <<
true;
735 void tst_QDtls::presetExpectedErrors()
738 QFETCH(
const bool, works);
740 connectHandshakeReadingSlots();
742 auto serverConfig = defaultServerConfig;
744 serverConfig.setLocalCertificate(selfSignedCert);
745 QVERIFY(serverCrypto->setDtlsConfiguration(serverConfig));
747 clientCrypto->ignoreVerificationErrors(expectedTlsErrors);
748 QVERIFY(clientCrypto->setPeer(serverAddress, serverPort));
749 QVERIFY(clientCrypto->doHandshake(&clientSocket));
758 QVERIFY(clientCrypto->isConnectionEncrypted());
761 QVERIFY(!clientCrypto->isConnectionEncrypted());
766 void tst_QDtls::verifyServerCertificate_data()
768 QTest::addColumn<QSslSocket::PeerVerifyMode>(
"verifyMode");
769 QTest::addColumn<QList<QSslCertificate>>(
"serverCerts");
770 QTest::addColumn<QSslKey>(
"serverKey");
771 QTest::addColumn<QString>(
"peerName");
772 QTest::addColumn<bool>(
"encrypted");
808 void tst_QDtls::verifyServerCertificate()
814 QFETCH(
const bool, encrypted);
816 auto serverConfig = defaultServerConfig;
818 serverConfig.setPrivateKey(serverKey);
819 QVERIFY(serverCrypto->setDtlsConfiguration(serverConfig));
821 auto clientConfig = QSslConfiguration::defaultDtlsConfiguration();
823 if (serverCerts.size() == 2 && encrypted) {
824 auto caCerts = clientConfig.caCertificates();
825 caCerts.append(serverCerts.at(1));
826 clientConfig.setCaCertificates(caCerts);
829 clientConfig.setPeerVerifyMode(verifyMode);
831 QVERIFY(clientCrypto->setDtlsConfiguration(clientConfig));
832 QVERIFY(clientCrypto->setPeer(serverAddress, serverPort, peerName));
834 connectHandshakeReadingSlots();
836 QVERIFY(clientCrypto->doHandshake(&clientSocket));
841 if (serverKey.isNull() && !serverCerts.isEmpty()) {
853 QVERIFY(!clientCrypto->isConnectionEncrypted());
855 QVERIFY(clientCrypto->peerVerificationErrors().size());
856 QVERIFY(clientCrypto->writeDatagramEncrypted(&clientSocket,
"something") < 0);
861 void tst_QDtls::verifyClientCertificate_data()
863 QTest::addColumn<QSslSocket::PeerVerifyMode>(
"verifyMode");
864 QTest::addColumn<QList<QSslCertificate>>(
"clientCerts");
865 QTest::addColumn<QSslKey>(
"clientKey");
866 QTest::addColumn<bool>(
"encrypted");
931 void tst_QDtls::verifyClientCertificate()
933 connectHandshakeReadingSlots();
938 QFETCH(
const bool, encrypted);
953 QVERIFY(serverCrypto->setDtlsConfiguration(serverConfig));
954 serverConfig = serverCrypto->dtlsConfiguration();
958 auto clientConfig = QSslConfiguration::defaultDtlsConfiguration();
959 clientConfig.setLocalCertificateChain(clientCerts);
960 clientConfig.setPrivateKey(clientKey);
962 QVERIFY(clientCrypto->setDtlsConfiguration(clientConfig));
963 QVERIFY(clientCrypto->setPeer(serverAddress, serverPort));
965 QVERIFY(clientCrypto->doHandshake(&clientSocket));
970 serverConfig = serverCrypto->dtlsConfiguration();
984 QVERIFY(!serverCrypto->isConnectionEncrypted());
986 QVERIFY(serverCrypto->dtlsErrorString().size() > 0);
987 QVERIFY(serverCrypto->peerVerificationErrors().size() > 0);
989 QVERIFY(!clientCrypto->isConnectionEncrypted());
995 void tst_QDtls::blacklistedCerificate()
1005 auto serverConfig = defaultServerConfig;
1008 QVERIFY(serverCrypto->setDtlsConfiguration(serverConfig));
1010 connectHandshakeReadingSlots();
1012 QVERIFY(clientCrypto->setPeer(serverAddress, serverPort,
name));
1013 QVERIFY(clientCrypto->doHandshake(&clientSocket));
1019 QVERIFY(!clientCrypto->isConnectionEncrypted());
1023 void tst_QDtls::readWriteEncrypted_data()
1025 QTest::addColumn<bool>(
"serverSideShutdown");
1031 void tst_QDtls::readWriteEncrypted()
1033 connectHandshakeReadingSlots();
1035 auto serverConfig = defaultServerConfig;
1038 QVERIFY(serverCrypto->setDtlsConfiguration(serverConfig));
1040 auto clientConfig = QSslConfiguration::defaultDtlsConfiguration();
1041 clientConfig.setCaCertificates({selfSignedCert});
1042 QVERIFY(clientCrypto->setDtlsConfiguration(clientConfig));
1043 QVERIFY(clientCrypto->setPeer(serverAddress, serverPort, hostName));
1047 QVERIFY(clientCrypto->writeDatagramEncrypted(&clientSocket, serverExpectedPlainText) <= 0);
1049 QVERIFY(!clientCrypto->shutdown(&clientSocket));
1052 QVERIFY(serverCrypto->writeDatagramEncrypted(&serverSocket, clientExpectedPlainText) <= 0);
1054 QVERIFY(!serverCrypto->shutdown(&serverSocket));
1058 QVERIFY(clientCrypto->doHandshake(&clientSocket));
1062 const QByteArray dummy = clientCrypto->decryptDatagram(&clientSocket,
"BS dgram");
1074 connectEncryptedReadingSlots();
1077 QVERIFY(clientCrypto->writeDatagramEncrypted(
nullptr, serverExpectedPlainText) <= 0);
1080 qint64 clientBytesWritten = clientCrypto->writeDatagramEncrypted(&clientSocket, serverExpectedPlainText);
1082 QVERIFY(clientBytesWritten > 0);
1088 QCOMPARE(serverExpectedPlainText, serverReceivedPlainText);
1089 QCOMPARE(clientExpectedPlainText, clientReceivedPlainText);
1091 QFETCH(
const bool, serverSideShutdown);
1092 DtlsPtr &crypto = serverSideShutdown ? serverCrypto : clientCrypto;
1095 QVERIFY(!crypto->shutdown(
nullptr));
1101 QVERIFY(!crypto->isConnectionEncrypted());
1106 DtlsPtr &peerCrypto = serverSideShutdown ? clientCrypto : serverCrypto;
1107 QVERIFY(!peerCrypto->isConnectionEncrypted());
1112 void tst_QDtls::datagramFragmentation()
1114 connectHandshakeReadingSlots();
1116 auto serverConfig = defaultServerConfig;
1119 QVERIFY(serverCrypto->setDtlsConfiguration(serverConfig));
1121 auto clientConfig = QSslConfiguration::defaultDtlsConfiguration();
1123 QVERIFY(clientCrypto->setDtlsConfiguration(clientConfig));
1124 QVERIFY(clientCrypto->setPeer(serverAddress, serverPort));
1126 QVERIFY(clientCrypto->doHandshake(&clientSocket));
1135 connectEncryptedReadingSlots();
1143 QVERIFY(clientCrypto->isConnectionEncrypted());
1144 QVERIFY(clientCrypto->writeDatagramEncrypted(&clientSocket,
"Hello, I'm a tiny datagram") > 0);
1153 if (
socket->pendingDatagramSize() <= 0)
1156 const bool isServer =
socket == &serverSocket;
1157 DtlsPtr &crypto = isServer ? serverCrypto : clientCrypto;
1158 DtlsPtr &peerCrypto = isServer ? clientCrypto : serverCrypto;
1174 if (
addr.isNull() ||
addr.isBroadcast())
1188 const QByteArray dummyDgram = crypto->decryptDatagram(&serverSocket, dgram);
1192 clientAddress =
addr;
1194 }
else if (clientPort !=
port || clientAddress !=
addr) {
1198 if (serverDropDgram) {
1199 serverDropDgram =
false;
1202 }
else if (clientDropDgram) {
1203 clientDropDgram =
false;
1207 if (!crypto->doHandshake(
socket, dgram))
1210 const auto state = crypto->handshakeState();
1223 if (
socket->pendingDatagramSize() <= 0)
1233 dtlsMessage.
resize(
int(bytesRead));
1235 if (
socket == &serverSocket) {
1236 if (
addr != clientAddress ||
port != clientPort)
1239 if (serverExpectedPlainText == dtlsMessage)
1242 serverReceivedPlainText = serverCrypto->decryptDatagram(
nullptr, dtlsMessage);
1246 serverReceivedPlainText = serverCrypto->decryptDatagram(&serverSocket, dtlsMessage);
1248 const int messageType = dtlsMessage.
data()[0];
1249 if (serverReceivedPlainText != serverExpectedPlainText
1250 && (messageType == 23 || messageType == 21)) {
1261 const QByteArray replayed = serverCrypto->decryptDatagram(&serverSocket, dtlsMessage);
1262 if (replayed.
size() > 0)
1265 if (serverCrypto->writeDatagramEncrypted(&serverSocket, clientExpectedPlainText) <= 0)
1268 if (
port != serverPort)
1271 if (clientExpectedPlainText == dtlsMessage)
1274 clientReceivedPlainText = clientCrypto->decryptDatagram(&clientSocket, dtlsMessage);
1288 auto crypto = qobject_cast<QDtls *>(
sender());
1291 if (!crypto->handleTimeout(&clientSocket))
1295 void tst_QDtls::clientServerData()
1297 QTest::addColumn<QSslSocket::SslMode>(
"mode");
1303 void tst_QDtls::connectHandshakeReadingSlots()
1309 void tst_QDtls::connectEncryptedReadingSlots()
1321 const auto errors = clientCrypto->peerVerificationErrors();
1343 #include "tst_qdtls.moc"
QHostAddress localAddress() const
virtual bool bind(const QHostAddress &address, quint16 port=0, BindMode mode=DefaultForPlatform)
SocketState state() const
quint16 localPort() const
The QByteArray class provides an array of bytes.
qsizetype size() const noexcept
const char * constData() const noexcept
void resize(qsizetype size)
This class provides encryption for UDP sockets.
bool setPeer(const QHostAddress &address, quint16 port, const QString &verificationName={})
QSslConfiguration dtlsConfiguration() const
bool setDtlsConfiguration(const QSslConfiguration &configuration)
bool doHandshake(QUdpSocket *socket, const QByteArray &dgram={})
QString peerVerificationName() const
QString dtlsErrorString() const
bool isConnectionEncrypted() const
QList< QSslError > peerVerificationErrors() const
QSslSocket::SslMode sslMode() const
HandshakeState handshakeState() const
QDtlsError dtlsError() const
QHostAddress peerAddress() const
QSslCipher sessionCipher() const
void pskRequired(QSslPreSharedKeyAuthenticator *authenticator)
GeneratorParameters cookieGeneratorParameters() const
QSsl::SslProtocol sessionProtocol() const
The QFile class provides an interface for reading from and writing to files.
bool open(OpenMode flags) override
The QFileInfo class provides system-independent file information.
QString absolutePath() const
The QHostAddress class provides an IP address.\inmodule QtNetwork.
qsizetype size() const noexcept
bool isEmpty() const noexcept
The QObject class is the base class of all Qt objects.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
static bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *member)
The QScopedPointer class stores a pointer to a dynamically allocated object, and deletes it upon dest...
The QSslCertificate class provides a convenient API for an X509 certificate.
static QList< QSslCertificate > fromPath(const QString &path, QSsl::EncodingFormat format=QSsl::Pem, PatternSyntax syntax=PatternSyntax::FixedString)
The QSslCipher class represents an SSL cryptographic cipher.
The QSslConfiguration class holds the configuration and state of an SSL connection.
QList< QSslCertificate > caCertificates() const
void setPeerVerifyMode(QSslSocket::PeerVerifyMode mode)
void setLocalCertificate(const QSslCertificate &certificate)
QList< QSslCertificate > peerCertificateChain() const
void setPrivateKey(const QSslKey &key)
void setLocalCertificateChain(const QList< QSslCertificate > &localChain)
QSslCertificate peerCertificate() const
static QSslConfiguration defaultConfiguration()
void setCaCertificates(const QList< QSslCertificate > &certificates)
void setProtocol(QSsl::SslProtocol protocol)
The QSslError class provides an SSL error.
The QSslKey class provides an interface for private and public keys.
The QSslPreSharedKeyAuthenticator class provides authentication data for pre shared keys (PSK) cipher...
Q_NETWORK_EXPORT void setPreSharedKey(const QByteArray &preSharedKey)
static bool supportsSsl()
The QString class provides a Unicode character string.
void enterLoopMSecs(int ms)
The QUdpSocket class provides a UDP socket.
void pskRequested(QSslPreSharedKeyAuthenticator *auth)
void encryptedReadyRead()
void handshakeReadyRead()
void handleHandshakeTimeout()
@ SslOptionDisableServerCipherPreference
QScopedPointer< QDtls > DtlsPtr
bool dtlsErrorIsCleared(DtlsPtr &dtls)
Q_TESTLIB_EXPORT QTestData & newRow(const char *dataTag)
Q_TESTLIB_EXPORT QTestData & addRow(const char *format,...) Q_ATTRIBUTE_FORMAT_PRINTF(1
constexpr Initialization Uninitialized
bool classImplemented(QSsl::ImplementedClass cl)
@ RemoteClosedConnectionError
GLenum GLuint GLintptr GLsizeiptr size
[1]
QScopeGuard< typename std::decay< F >::type > qScopeGuard(F &&f)
[qScopeGuard]
#define QStringLiteral(str)
#define QTEST_MAIN(TestObject)
#define QSKIP(statement,...)
#define QFETCH(Type, name)
#define QVERIFY(statement)
#define QFINDTESTDATA(basepath)
QList< QSslCertificate > cert
[0]
bool contains(const AT &t) const noexcept
QThreadStorage< int * > dummy[8]
#define QDTLS_VERIFY_HANDSHAKE_SUCCESS(obj)
#define QDTLS_VERIFY_NO_ERROR(obj)
QT_END_NAMESPACE QT_BEGIN_NAMESPACE void qt_ForceTlsSecurityLevel()