356#include <QtCore/qdebug.h>
357#include <QtCore/qdir.h>
358#include <QtCore/qmutex.h>
359#include <QtCore/qurl.h>
360#include <QtCore/qelapsedtimer.h>
361#include <QtNetwork/qhostaddress.h>
362#include <QtNetwork/qhostinfo.h>
397#ifdef QSSLSOCKET_DEBUG
398 qCDebug(lcSsl) <<
"QSslSocket::QSslSocket(" <<
parent <<
"), this =" << (
void *)
this;
410#ifdef QSSLSOCKET_DEBUG
411 qCDebug(lcSsl) <<
"QSslSocket::~QSslSocket(), this =" << (
void *)
this;
413 delete d->plainSocket;
414 d->plainSocket =
nullptr;
484 "QSslSocket::connectToHostEncrypted() called when already connecting/connected");
489 qCWarning(lcSsl,
"QSslSocket::connectToHostEncrypted: TLS initialization failed");
494 if (!
d->verifyProtocolSupported(
"QSslSocket::connectToHostEncrypted:"))
498 d->autoStartHandshake =
true;
499 d->initialized =
true;
524 "QSslSocket::connectToHostEncrypted() called when already connecting/connected");
529 qCWarning(lcSsl,
"QSslSocket::connectToHostEncrypted: TLS initialization failed");
535 d->autoStartHandshake =
true;
536 d->initialized =
true;
537 d->verificationPeerName = sslPeerName;
559#ifdef QSSLSOCKET_DEBUG
566 d->cachedSocketDescriptor =
d->plainSocket->socketDescriptor();
567 d->setError(
d->plainSocket->error(),
d->plainSocket->errorString());
575 d->readChannelCount =
d->plainSocket->readChannelCount();
576 d->writeChannelCount =
d->plainSocket->writeChannelCount();
603 return d->plainSocket->socketOption(
option);
642 return d->connectionEncrypted;
653 return d->configuration.protocol;
684 return d->configuration.peerVerifyMode;
707 d->configuration.peerVerifyMode =
mode;
726 return d->configuration.peerVerifyDepth;
746 qCWarning(lcSsl,
"QSslSocket::setPeerVerifyDepth: cannot set negative depth of %d",
depth);
749 d->configuration.peerVerifyDepth =
depth;
763 return d->verificationPeerName;
777 d->verificationPeerName = hostName;
804 return d->plainSocket ?
d->plainSocket->bytesToWrite() : 0;
805 return d->writeBuffer.size();
820 return d->plainSocket->bytesAvailable();
834 return d->plainSocket->bytesToWrite();
856#ifdef QSSLSOCKET_DEBUG
857 qCDebug(lcSsl) <<
"QSslSocket::close()";
864 if (
auto *backend =
d->backend.get())
865 backend->cancelCAFetch();
869 if (
d->plainSocket) {
871 d->plainSocket->abort();
873 d->plainSocket->close();
879 d->writeBuffer.clear();
901 d->readBufferMaxSize =
size;
904 d->plainSocket->setReadBufferSize(
size);
927 copy->ref.storeRelaxed(0);
928 copy->sessionCipher =
d->sessionCipher();
929 copy->sessionProtocol =
d->sessionProtocol();
950 d->configuration.privateKey = configuration.
privateKey();
951 d->configuration.ciphers = configuration.
ciphers();
958 d->configuration.protocol = configuration.
protocol();
960 d->configuration.sslOptions = configuration.d->
sslOptions;
969#if QT_CONFIG(openssl)
977 d->allowRootCertOnDemandLoading =
false;
978 d->configuration.allowRootCertOnDemandLoading =
false;
992 d->configuration.localCertificateChain = localChain;
1005 return d->configuration.localCertificateChain;
1031 d->configuration.localCertificateChain += certificate;
1059 if (
d->configuration.localCertificateChain.isEmpty())
1061 return d->configuration.localCertificateChain[0];
1092 return d->configuration.peerCertificate;
1121 return d->configuration.peerCertificateChain;
1143 return d->sessionCipher();
1157 return d->sessionProtocol();
1172 if (
const auto *backend =
d->backend.get())
1173 return backend->ocsps();
1193 d->configuration.privateKey =
key;
1221 qCWarning(lcSsl,
"QSslSocket::setPrivateKey: Couldn't open file for reading");
1227 qCWarning(lcSsl,
"QSslSocket::setPrivateKey: "
1228 "The specified file does not contain a valid key");
1233 d->configuration.privateKey =
key;
1244 return d->configuration.privateKey;
1257 if (!
d->plainSocket)
1259 bool retVal =
d->plainSocket->waitForConnected(msecs);
1262 d->setError(
d->plainSocket->error(),
d->plainSocket->errorString());
1286 if (!
d->plainSocket ||
d->connectionEncrypted)
1290 if (!
d->verifyProtocolSupported(
"QSslSocket::waitForEncrypted:"))
1298 if (!
d->plainSocket->waitForConnected(msecs))
1302 while (!
d->connectionEncrypted) {
1311 return d->connectionEncrypted;
1320 if (!
d->plainSocket)
1323 return d->plainSocket->waitForReadyRead(msecs);
1329 bool readyReadEmitted =
false;
1330 bool *previousReadyReadEmittedPointer =
d->readyReadEmittedPointer;
1331 d->readyReadEmittedPointer = &readyReadEmitted;
1336 if (!
d->connectionEncrypted) {
1339 d->readyReadEmittedPointer = previousReadyReadEmittedPointer;
1344 if (!
d->writeBuffer.isEmpty()) {
1351 while (!readyReadEmitted &&
1355 d->readyReadEmittedPointer = previousReadyReadEmittedPointer;
1356 return readyReadEmitted;
1365 if (!
d->plainSocket)
1368 return d->plainSocket->waitForBytesWritten(msecs);
1373 if (!
d->connectionEncrypted) {
1378 if (!
d->writeBuffer.isEmpty()) {
1399 qCWarning(lcSsl,
"QSslSocket::waitForDisconnected() is not allowed in UnconnectedState");
1403 if (!
d->plainSocket)
1407 return d->plainSocket->waitForDisconnected(msecs);
1412 if (!
d->connectionEncrypted) {
1419 if (!
d->writeBuffer.isEmpty())
1431 d->setError(
d->plainSocket->error(),
d->plainSocket->errorString());
1449 if (
const auto *backend =
d->backend.get())
1450 return backend->tlsErrors();
1473 return tlsBackend->tlsLibraryVersionNumber();
1487 return tlsBackend->tlsLibraryVersionString();
1501 return tlsBackend->tlsLibraryBuildVersionNumber();
1516 return tlsBackend->tlsLibraryBuildVersionString();
1572 qCWarning(lcSsl,
"Invalid parameter (backend name cannot be an empty string)");
1579 <<
"as active, another backend is already in use";
1619 return versions.contains(
protocol);
1690 "QSslSocket::startClientEncryption: cannot start handshake on non-plain connection");
1695 "QSslSocket::startClientEncryption: cannot start handshake when not connected");
1700 qCWarning(lcSsl,
"QSslSocket::startClientEncryption: TLS initialization failed");
1705 if (!
d->verifyProtocolSupported(
"QSslSocket::startClientEncryption:"))
1708#ifdef QSSLSOCKET_DEBUG
1709 qCDebug(lcSsl) <<
"QSslSocket::startClientEncryption()";
1713 d->startClientEncryption();
1740 qCWarning(lcSsl,
"QSslSocket::startServerEncryption: cannot start handshake on non-plain connection");
1743#ifdef QSSLSOCKET_DEBUG
1744 qCDebug(lcSsl) <<
"QSslSocket::startServerEncryption()";
1747 qCWarning(lcSsl,
"QSslSocket::startServerEncryption: TLS initialization failed");
1751 if (!
d->verifyProtocolSupported(
"QSslSocket::startServerEncryption"))
1756 d->startServerEncryption();
1787 d->ignoreAllSslErrors =
true;
1814 d->ignoreErrorsList = errors;
1831 if (
auto *backend =
d->backend.get())
1832 backend->enableHandshakeContinuation();
1841 d->preferredNetworkLayerProtocol =
protocol;
1842 if (!
d->initialized)
1844 d->initialized =
false;
1846#ifdef QSSLSOCKET_DEBUG
1847 qCDebug(lcSsl) <<
"QSslSocket::connectToHost("
1850 if (!
d->plainSocket) {
1851#ifdef QSSLSOCKET_DEBUG
1852 qCDebug(lcSsl) <<
"\tcreating internal plain socket";
1856#ifndef QT_NO_NETWORKPROXY
1857 d->plainSocket->setProtocolTag(
d->protocolTag);
1858 d->plainSocket->setProxy(
proxy());
1861 d->readChannelCount =
d->writeChannelCount = 0;
1862 d->plainSocket->connectToHost(hostName,
port,
openMode,
d->preferredNetworkLayerProtocol);
1863 d->cachedSocketDescriptor =
d->plainSocket->socketDescriptor();
1872#ifdef QSSLSOCKET_DEBUG
1873 qCDebug(lcSsl) <<
"QSslSocket::disconnectFromHost()";
1875 if (!
d->plainSocket)
1880 d->plainSocket->disconnectFromHost();
1884 d->pendingClose =
true;
1889 if (
auto *backend =
d->backend.get())
1890 backend->cancelCAFetch();
1898 if (!
d->writeBuffer.isEmpty()) {
1899 d->pendingClose =
true;
1904 d->plainSocket->disconnectFromHost();
1906 d->disconnectFromHost();
1919 readBytes =
d->plainSocket->read(
data, maxlen);
1920#ifdef QSSLSOCKET_DEBUG
1921 qCDebug(lcSsl) <<
"QSslSocket::readData(" << (
void *)
data <<
',' << maxlen <<
") =="
1926 if (
d->plainSocket->bytesAvailable() ||
d->hasUndecryptedData())
1941#ifdef QSSLSOCKET_DEBUG
1942 qCDebug(lcSsl) <<
"QSslSocket::writeData(" << (
void *)
data <<
',' <<
len <<
')';
1945 return d->plainSocket->write(
data,
len);
1950 if (!
d->flushTriggered) {
1951 d->flushTriggered =
true;
1964 : initialized(
false)
1966 , autoStartHandshake(
false)
1967 , connectionEncrypted(
false)
1968 , ignoreAllSslErrors(
false)
1969 , readyReadEmittedPointer(
nullptr)
1970 , allowRootCertOnDemandLoading(true)
1973 , flushTriggered(
false)
1983 qCWarning(lcSsl,
"No TLS backend is available");
1989 <<
"does not support TLS";
2058 auto protocolName =
"DTLS"_L1;
2063 protocolName =
"UnknownProtocol"_L1;
2067 case QSsl::DtlsV1_0:
2069 case QSsl::DtlsV1_0OrLater:
2071 qCWarning(lcSsl) << where <<
"QSslConfiguration with unexpected protocol" << protocolName;
2073 QSslSocket::tr(
"Attempted to use an unsupported protocol."));
2088 return globalData()->config->ciphers;
2098 return globalData()->supportedCiphers;
2107 globalData()->config.detach();
2108 globalData()->config->ciphers = ciphers;
2117 globalData()->config.detach();
2118 globalData()->supportedCiphers = ciphers;
2136 for (
int id :
ids) {
2155 globalData()->dtlsConfig.detach();
2156 globalData()->dtlsConfig->ciphers = ciphers;
2166 return globalData()->dtlsConfig->ciphers;
2176 return globalData()->supportedEllipticCurves;
2185 globalData()->config.detach();
2186 globalData()->dtlsConfig.detach();
2187 globalData()->supportedEllipticCurves = curves;
2197 return globalData()->config->caCertificates;
2207 globalData()->config.detach();
2208 globalData()->config->caCertificates =
certs;
2209 globalData()->dtlsConfig.detach();
2210 globalData()->dtlsConfig->caCertificates =
certs;
2223 if (globalData()->
config->caCertificates.contains(
cert))
2225 globalData()->config.detach();
2226 globalData()->config->caCertificates +=
cert;
2227 globalData()->dtlsConfig.
detach();
2228 globalData()->dtlsConfig->caCertificates +=
cert;
2238 globalData()->config.detach();
2239 globalData()->config->caCertificates +=
certs;
2240 globalData()->dtlsConfig.detach();
2241 globalData()->dtlsConfig->caCertificates +=
certs;
2261 if (globalData()->
config == configuration.d)
2279 ptr->ref.storeRelaxed(1);
2280 ptr->peerCertificate =
global->peerCertificate;
2281 ptr->peerCertificateChain =
global->peerCertificateChain;
2282 ptr->localCertificateChain =
global->localCertificateChain;
2284 ptr->sessionCipher =
global->sessionCipher;
2285 ptr->sessionProtocol =
global->sessionProtocol;
2287 ptr->caCertificates =
global->caCertificates;
2288 ptr->allowRootCertOnDemandLoading =
global->allowRootCertOnDemandLoading;
2290 ptr->peerVerifyMode =
global->peerVerifyMode;
2291 ptr->peerVerifyDepth =
global->peerVerifyDepth;
2293 ptr->ellipticCurves =
global->ellipticCurves;
2294 ptr->backendConfig =
global->backendConfig;
2296 ptr->dtlsCookieEnabled =
global->dtlsCookieEnabled;
2299 ptr->ocspStaplingEnabled =
global->ocspStaplingEnabled;
2301#if QT_CONFIG(openssl)
2302 ptr->reportFromCallback =
global->reportFromCallback;
2303 ptr->missingCertIsFatal =
global->missingCertIsFatal;
2325 if (globalData()->dtlsConfig == configuration.d)
2377#ifndef QT_NO_NETWORKPROXY
2393 if (!
socket->d_func()->plainSocket)
2400 if (!
socket->d_func()->plainSocket)
2422#ifdef QSSLSOCKET_DEBUG
2426#ifdef QSSLSOCKET_DEBUG
2427 qCDebug(lcSsl) <<
"\tcreating internal plain socket";
2454#ifdef QSSLSOCKET_DEBUG
2455 qCDebug(lcSsl) <<
"QSslSocket::_q_connectedSlot()";
2456 qCDebug(lcSsl) <<
"\tstate =" <<
q->state();
2457 qCDebug(lcSsl) <<
"\tpeer =" <<
q->peerName() <<
q->peerAddress() <<
q->peerPort();
2459 <<
q->localAddress() <<
q->localPort();
2463 q->startClientEncryption();
2465 emit q->connected();
2469 q->disconnectFromHost();
2479#ifdef QSSLSOCKET_DEBUG
2480 qCDebug(lcSsl) <<
"QSslSocket::_q_hostFoundSlot()";
2481 qCDebug(lcSsl) <<
"\tstate =" <<
q->state();
2483 emit q->hostFound();
2492#ifdef QSSLSOCKET_DEBUG
2493 qCDebug(lcSsl) <<
"QSslSocket::_q_disconnectedSlot()";
2494 qCDebug(lcSsl) <<
"\tstate =" <<
q->state();
2497 emit q->disconnected();
2513#ifdef QSSLSOCKET_DEBUG
2514 qCDebug(lcSsl) <<
"QSslSocket::_q_stateChangedSlot(" <<
state <<
')';
2516 q->setSocketState(
state);
2526#ifdef QSSLSOCKET_DEBUG
2528 qCDebug(lcSsl) <<
"QSslSocket::_q_errorSlot(" <<
error <<
')';
2529 qCDebug(lcSsl) <<
"\tstate =" <<
q->state();
2530 qCDebug(lcSsl) <<
"\terrorString =" <<
q->errorString();
2549#ifdef QSSLSOCKET_DEBUG
2555 emit q->readyRead();
2578#ifdef QSSLSOCKET_DEBUG
2579 qCDebug(lcSsl) <<
"QSslSocket::_q_bytesWrittenSlot(" << written <<
')';
2583 emit q->bytesWritten(written);
2585 emit q->encryptedBytesWritten(written);
2587 q->disconnectFromHost();
2606 emit q->readChannelFinished();
2645 const auto sslErrors =
backend->tlsErrors();
2662 bool doEmitSslError;
2667 const auto &sslErrors =
backend->tlsErrors();
2668 doEmitSslError =
false;
2669 for (
int a = 0;
a < sslErrors.size();
a++) {
2671 doEmitSslError =
true;
2681 return !doEmitSslError;
2785 return (
r > 0 ?
r :
r2);
2805 ret.reserve(maxSize);
2807 if (
ret.size() == maxSize)
2828 return d->plainSocket->skip(maxSize);
2841#ifdef QSSLSOCKET_DEBUG
2842 qCDebug(lcSsl) <<
"QSslSocketPrivate::flush()";
2858 backend->startClientEncryption();
2867 backend->startServerEncryption();
2885 backend->disconnectFromHost();
2903 return backend->sessionCipher();
2914 return backend->sessionProtocol();
2949 const auto ba = [](
const auto &cstr)
constexpr {
2953 ba(
"/etc/ssl/certs/"),
2954 ba(
"/usr/lib/ssl/certs/"),
2955 ba(
"/usr/share/ssl/"),
2956 ba(
"/usr/local/ssl/"),
2957 ba(
"/var/ssl/certs/"),
2958 ba(
"/usr/local/ssl/certs/"),
2959 ba(
"/etc/openssl/certs/"),
2960 ba(
"/opt/openssl/certs/"),
2975 backend->checkSettingSslContext(tlsContext);
2995 if (!hostAddress.
isNull()) {
2996 const auto subjectAlternativeNames =
cert.subjectAlternativeNames();
2999 for (
auto it = ipAddresses.first;
it != ipAddresses.second;
it++) {
3008 for (
const QString &commonName : commonNames) {
3013 const auto subjectAlternativeNames =
cert.subjectAlternativeNames();
3014 const auto altNames = subjectAlternativeNames.equal_range(
QSsl::DnsEntry);
3015 for (
auto it = altNames.first;
it != altNames.second; ++
it) {
3039 if ((-1 == secondCnDot) || (secondCnDot+1 >= cn.
size()))
3043 if (wildcard+1 != firstCnDot)
3088 qCWarning(lcSsl,
"No functional TLS backend was found");
3152#include "moc_qsslsocket.cpp"
IOBluetoothL2CAPChannel * channel
qintptr cachedSocketDescriptor
void proxyAuthenticationRequired(const QNetworkProxy &proxy, QAuthenticator *authenticator) override
QHostAddress localAddress
static void pauseSocketNotifiers(QAbstractSocket *)
QAbstractSocket::SocketState state
static void resumeSocketNotifiers(QAbstractSocket *)
void setErrorAndEmit(QAbstractSocket::SocketError errorCode, const QString &errorString)
SocketState
This enum describes the different states in which a socket can be.
bool flush()
This function writes as much as possible from the internal write buffer to the underlying network soc...
void stateChanged(QAbstractSocket::SocketState)
This signal is emitted whenever QAbstractSocket's state changes.
quint16 peerPort() const
Returns the port of the connected peer if the socket is in ConnectedState; otherwise returns 0.
virtual qintptr socketDescriptor() const
Returns the native socket descriptor of the QAbstractSocket object if this is available; otherwise re...
void setPeerPort(quint16 port)
qint64 bytesAvailable() const override
Returns the number of incoming bytes that are waiting to be read.
QHostAddress localAddress() const
Returns the host address of the local socket if available; otherwise returns QHostAddress::Null.
QString peerName() const
Returns the name of the peer as specified by connectToHost(), or an empty QString if connectToHost() ...
QNetworkProxy proxy() const
virtual bool bind(const QHostAddress &address, quint16 port=0, BindMode mode=DefaultForPlatform)
virtual void disconnectFromHost()
Attempts to close the socket.
void setPeerAddress(const QHostAddress &address)
void setLocalPort(quint16 port)
void setLocalAddress(const QHostAddress &address)
SocketState state() const
Returns the state of the socket.
SocketError
This enum describes the socket errors that can occur.
@ SslInvalidUserDataError
@ SslHandshakeFailedError
void setSocketState(SocketState state)
Sets the state of the socket to state.
quint16 localPort() const
Returns the host port number (in native byte order) of the local socket if available; otherwise retur...
void setPeerName(const QString &name)
SocketError error() const
Returns the type of error that last occurred.
QHostAddress peerAddress() const
Returns the address of the connected peer if the socket is in ConnectedState; otherwise returns QHost...
The QAuthenticator class provides an authentication object.
static QByteArray fromRawData(const char *data, qsizetype size)
Constructs a QByteArray that uses the first size bytes of the data array.
qint64 elapsed() const noexcept
Returns the number of milliseconds since this QElapsedTimer was last started.
void start() noexcept
Starts this timer.
bool open(OpenMode flags) override
Opens the file using OpenMode mode, returning true if successful; otherwise false.
The QHostAddress class provides an IP address.
bool isNull() const
Returns true if this host address is not valid for any host or interface.
bool isEqual(const QHostAddress &address, ConversionMode mode=TolerantConversion) const
QString hostName() const
Returns the name of the host whose IP addresses were looked up.
static QHostInfo fromName(const QString &name)
Looks up the IP address(es) for the given host name.
QIODevice::OpenMode openMode
virtual qint64 peek(char *data, qint64 maxSize)
QRingBufferRef writeBuffer
virtual bool open(QIODeviceBase::OpenMode mode)
Opens the device and sets its OpenMode to mode.
int writeChannelCount() const
virtual qint64 size() const
For open random-access devices, this function returns the size of the device.
void setOpenMode(QIODeviceBase::OpenMode openMode)
Sets the OpenMode of the device to openMode.
QByteArray readAll()
Reads all remaining data from the device, and returns it as a byte array.
QIODeviceBase::OpenMode openMode() const
Returns the mode in which the device has been opened; i.e.
qint64 peek(char *data, qint64 maxlen)
QString errorString() const
Returns a human-readable description of the last device error that occurred.
virtual void close()
First emits aboutToClose(), then closes the device and sets its OpenMode to NotOpen.
virtual bool atEnd() const
Returns true if the current read and write position is at the end of the device (i....
int readChannelCount() const
virtual bool canReadLine() const
Returns true if a complete line of data can be read from the device; otherwise returns false.
bool empty() const noexcept
static QList< T > fromReadOnlyData(const T(&t)[N]) noexcept
void reserve(qsizetype size)
void append(parameter_type t)
void unlock() noexcept
Unlocks this mutex locker.
The QNetworkProxy class provides a network layer proxy.
static QMetaObject::Connection connect(const QObject *sender, const char *signal, const QObject *receiver, const char *member, Qt::ConnectionType=Qt::AutoConnection)
\threadsafe
void destroyed(QObject *=nullptr)
This signal is emitted immediately before the object obj is destroyed, after any instances of QPointe...
const T * constData() const noexcept
Returns a const pointer to the shared data object.
The QSslCertificate class provides a convenient API for an X509 certificate.
void clear()
Clears the contents of this certificate, making it a null certificate.
The QSslCipher class represents an SSL cryptographic cipher.
QSsl::SslProtocol protocol
QSsl::SslOptions sslOptions
bool allowRootCertOnDemandLoading
static QSslConfiguration defaultConfiguration()
static void setDefaultDtlsConfiguration(const QSslConfiguration &configuration)
static void deepCopyDefaultConfiguration(QSslConfigurationPrivate *config)
QList< QSslCertificate > peerCertificateChain
static void setDefaultConfiguration(const QSslConfiguration &configuration)
QSslCertificate peerCertificate
static QSslConfiguration defaultDtlsConfiguration()
The QSslConfiguration class holds the configuration and state of an SSL connection.
QList< QByteArray > allowedNextProtocols() const
QList< QSslCertificate > caCertificates() const
Returns this connection's CA certificate database.
bool ocspStaplingEnabled() const
QList< QSslCertificate > localCertificateChain() const
Returns the certificate chain to be presented to the peer during the SSL handshake process.
QSslSocket::PeerVerifyMode peerVerifyMode() const
Returns the verify mode.
QSsl::SslProtocol protocol() const
Returns the protocol setting for this SSL configuration.
QSslDiffieHellmanParameters diffieHellmanParameters() const
QByteArray preSharedKeyIdentityHint() const
int sessionTicketLifeTimeHint() const
int peerVerifyDepth() const
Returns the maximum number of certificates in the peer's certificate chain to be checked during the S...
QByteArray nextNegotiatedProtocol() const
QSslKey privateKey() const
Returns the \l {QSslKey} {SSL key} assigned to this connection or a null key if none has been assigne...
QList< QSslEllipticCurve > ellipticCurves() const
QList< QSslCipher > ciphers() const
Returns this connection's current cryptographic cipher suite.
QByteArray sessionTicket() const
bool handshakeMustInterruptOnError() const
bool missingCertificateIsFatal() const
QMap< QByteArray, QVariant > backendConfiguration() const
NextProtocolNegotiationStatus nextProtocolNegotiationStatus() const
Represents an elliptic curve for use by elliptic-curve cipher algorithms.
The QSslKey class provides an interface for private and public keys.
QExplicitlySharedDataPointer< QSslConfigurationPrivate > dtlsConfig
QExplicitlySharedDataPointer< QSslConfigurationPrivate > config
QList< QSslEllipticCurve > supportedEllipticCurves
QList< QSslCipher > supportedCiphers
bool * readyReadPointer()
bool verifyErrorsHaveBeenIgnored()
static void setDefaultCaCertificates(const QList< QSslCertificate > &certs)
void setEncrypted(bool enc)
static void setDefaultDtlsCiphers(const QList< QSslCipher > &ciphers)
static bool supportsSsl()
void setMaxReadBufferSize(qint64 maxSize)
static void addDefaultCaCertificate(const QSslCertificate &cert)
QTcpSocket * plainTcpSocket() const
QString verificationName() const
void _q_readChannelFinishedSlot()
void startServerEncryption()
QSslCipher sessionCipher() const
bool isAutoStartingHandshake() const
bool * readyReadEmittedPointer
static QTlsBackend * tlsBackendInUse()
void _q_flushReadBuffer()
static void setDefaultCiphers(const QList< QSslCipher > &ciphers)
static void resumeSocketNotifiers(QSslSocket *)
QString verificationPeerName
qint64 peek(char *data, qint64 maxSize) override
void _q_channelReadyReadSlot(int)
static void setRootCertOnDemandLoadingSupported(bool supported)
bool isRootsOnDemandAllowed() const
static std::shared_ptr< QSslContext > sslContext(QSslSocket *socket)
static QList< QSslCertificate > defaultCaCertificates()
bool allowRootCertOnDemandLoading
static void ensureInitialized()
void _q_flushWriteBuffer()
qint64 maxReadBufferSize() const
bool & tlsEmittedBytesWritten()
QString tlsHostName() const
static QList< QByteArray > unixRootCertDirectories()
std::unique_ptr< QTlsPrivate::TlsCryptograph > backend
QRingBufferRef & tlsBuffer()
static QList< QSslCipher > defaultDtlsCiphers()
bool verifyProtocolSupported(const char *where)
static void checkSettingSslContext(QSslSocket *, std::shared_ptr< QSslContext >)
static QList< QSslCipher > supportedCiphers()
void _q_stateChangedSlot(QAbstractSocket::SocketState)
static bool rootCertOnDemandLoadingSupported()
static QString activeBackendName
static QList< QSslEllipticCurve > supportedEllipticCurves()
static void addDefaultCaCertificates(const QList< QSslCertificate > &certs)
static QMutex backendMutex
void _q_errorSlot(QAbstractSocket::SocketError)
void _q_resumeImplementation()
void createPlainSocket(QIODevice::OpenMode openMode)
void setPendingClose(bool pc)
virtual ~QSslSocketPrivate()
static void pauseSocketNotifiers(QSslSocket *)
bool hasUndecryptedData() const
void _q_bytesWrittenSlot(qint64)
QRingBufferRef & tlsWriteBuffer()
QSsl::SslProtocol sessionProtocol() const
void _q_channelBytesWrittenSlot(int, qint64)
QList< QSslError > ignoreErrorsList
static QList< QSslCertificate > systemCaCertificates()
static void resetDefaultEllipticCurves()
static void setDefaultSupportedEllipticCurves(const QList< QSslEllipticCurve > &curves)
static bool isMatchingHostname(const QSslCertificate &cert, const QString &peerName)
void disconnectFromHost()
static bool s_loadRootCertsOnDemand
QSslSocket::SslMode tlsMode() const
static QList< QSslCipher > defaultCiphers()
static void setDefaultSupportedCiphers(const QList< QSslCipher > &ciphers)
bool bind(const QHostAddress &address, quint16, QAbstractSocket::BindMode) override
static QTlsBackend * tlsBackend
void _q_disconnectedSlot()
bool isPendingClose() const
QSslConfigurationPrivate configuration
void startClientEncryption()
The QSslSocket class provides an SSL encrypted socket for both clients and servers.
QList< QSslCertificate > peerCertificateChain() const
Returns the peer's chain of digital certificates, or an empty list of certificates.
void resume() override
\reimp
static QString sslLibraryBuildVersionString()
static QList< QSsl::ImplementedClass > implementedClasses(const QString &backendName={})
QSslConfiguration sslConfiguration() const
void setLocalCertificateChain(const QList< QSslCertificate > &localChain)
Sets the certificate chain to be presented to the peer during the SSL handshake to be localChain.
bool isEncrypted() const
Returns true if the socket is encrypted; otherwise, false is returned.
bool canReadLine() const override
\reimp
void disconnectFromHost() override
QList< QOcspResponse > ocspResponses() const
bool waitForReadyRead(int msecs=30000) override
\reimp
static bool setActiveBackend(const QString &backendName)
bool waitForBytesWritten(int msecs=30000) override
\reimp
void setPrivateKey(const QSslKey &key)
Sets the socket's private \l {QSslKey} {key} to key.
qint64 skipData(qint64 maxSize) override
\reimp
static QList< QSsl::SslProtocol > supportedProtocols(const QString &backendName={})
virtual void setSocketOption(QAbstractSocket::SocketOption option, const QVariant &value) override
QSslCipher sessionCipher() const
Returns the socket's cryptographic \l {QSslCipher} {cipher}, or a null cipher if the connection isn't...
void startServerEncryption()
Starts a delayed SSL handshake for a server connection.
QString peerVerifyName() const
void ignoreSslErrors()
This slot tells QSslSocket to ignore errors during QSslSocket's handshake phase and continue connecti...
bool setSocketDescriptor(qintptr socketDescriptor, SocketState state=ConnectedState, OpenMode openMode=ReadWrite) override
Initializes QSslSocket with the native socket descriptor socketDescriptor.
static long sslLibraryVersionNumber()
QSslSocket::PeerVerifyMode peerVerifyMode() const
SslMode
Describes the connection modes available for QSslSocket.
void setPeerVerifyMode(QSslSocket::PeerVerifyMode mode)
SslMode mode() const
Returns the current mode for the socket; either UnencryptedMode, where QSslSocket behaves identially ...
qint64 writeData(const char *data, qint64 len) override
\reimp
QSsl::SslProtocol protocol() const
Returns the socket's SSL protocol.
QList< QSslError > sslHandshakeErrors() const
static QList< QSsl::SupportedFeature > supportedFeatures(const QString &backendName={})
qint64 bytesToWrite() const override
\reimp
int peerVerifyDepth() const
bool waitForEncrypted(int msecs=30000)
Waits until the socket has completed the SSL handshake and has emitted encrypted(),...
qint64 readData(char *data, qint64 maxlen) override
\reimp
qint64 encryptedBytesAvailable() const
void close() override
\reimp
static bool supportsSsl()
Returns true if this platform supports SSL; otherwise, returns false.
void setSslConfiguration(const QSslConfiguration &config)
void connectToHost(const QString &hostName, quint16 port, OpenMode openMode=ReadWrite, NetworkLayerProtocol protocol=AnyIPProtocol) override
~QSslSocket()
Destroys the QSslSocket.
bool waitForDisconnected(int msecs=30000) override
Waits until the socket has disconnected or msecs milliseconds, whichever comes first.
static long sslLibraryBuildVersionNumber()
virtual QVariant socketOption(QAbstractSocket::SocketOption option) override
static QString sslLibraryVersionString()
void connectToHostEncrypted(const QString &hostName, quint16 port, OpenMode mode=ReadWrite, NetworkLayerProtocol protocol=AnyIPProtocol)
Starts an encrypted connection to the device hostName on port, using mode as the \l OpenMode.
void setPeerVerifyName(const QString &hostName)
QSslCertificate localCertificate() const
Returns the socket's local \l {QSslCertificate} {certificate}, or an empty certificate if no local ce...
qint64 encryptedBytesToWrite() const
void continueInterruptedHandshake()
static bool isClassImplemented(QSsl::ImplementedClass cl, const QString &backendName={})
void setReadBufferSize(qint64 size) override
QSsl::SslProtocol sessionProtocol() const
Returns the socket's SSL/TLS protocol or UnknownProtocol if the connection isn't encrypted.
static bool isProtocolSupported(QSsl::SslProtocol protocol, const QString &backendName={})
static QList< QString > availableBackends()
void setPeerVerifyDepth(int depth)
static bool isFeatureSupported(QSsl::SupportedFeature feat, const QString &backendName={})
QSslKey privateKey() const
Returns this socket's private key.
void setProtocol(QSsl::SslProtocol protocol)
Sets the socket's SSL protocol to protocol.
QList< QSslCertificate > localCertificateChain() const
Returns the socket's local \l {QSslCertificate} {certificate} chain, or an empty list if no local cer...
void modeChanged(QSslSocket::SslMode newMode)
This signal is emitted when QSslSocket changes from \l QSslSocket::UnencryptedMode to either \l QSslS...
bool waitForConnected(int msecs=30000) override
Waits until the socket is connected, or msecs milliseconds, whichever happens first.
qint64 bytesAvailable() const override
\reimp
static QString activeBackend()
void startClientEncryption()
Starts a delayed SSL handshake for a client connection.
bool atEnd() const override
\reimp
QSslCertificate peerCertificate() const
Returns the peer's digital certificate (i.e., the immediate certificate of the host you are connected...
void setLocalCertificate(const QSslCertificate &certificate)
Sets the socket's local certificate to certificate.
\macro QT_RESTRICTED_CAST_FROM_ASCII
qsizetype lastIndexOf(QChar c, Qt::CaseSensitivity cs=Qt::CaseSensitive) const noexcept
bool startsWith(const QString &s, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
Returns true if the string starts with s; otherwise returns false.
static QString fromLatin1(QByteArrayView ba)
This is an overloaded member function, provided for convenience. It differs from the above function o...
qsizetype size() const
Returns the number of characters in this string.
QString mid(qsizetype position, qsizetype n=-1) const
Returns a string that contains n characters of this string, starting at the specified position index.
QString left(qsizetype n) const
Returns a substring that contains the n leftmost characters of the string.
static QString static QString qsizetype indexOf(QChar c, qsizetype from=0, Qt::CaseSensitivity cs=Qt::CaseSensitive) const
The QTcpSocket class provides a TCP socket.
QTlsBackend is a factory class, providing implementations for the QSsl classes.
virtual QList< QSslCertificate > systemCaCertificates() const
virtual QList< QSsl::SupportedFeature > supportedFeatures() const =0
virtual QString backendName() const =0
virtual QList< QSsl::SslProtocol > supportedProtocols() const =0
static QList< QString > availableBackendNames()
virtual QTlsPrivate::TlsCryptograph * createTlsCryptograph() const
virtual QList< QSsl::ImplementedClass > implementedClasses() const =0
virtual void ensureInitialized() const
virtual QList< int > ellipticCurvesIds() const
static QString defaultBackendName()
static QTlsBackend * findBackend(const QString &backendName)
static QByteArray toAce(const QString &domain, AceProcessingOptions options={})
QSet< QString >::iterator it
KeyAlgorithm
Describes the different key algorithms supported by QSslKey.
EncodingFormat
Describes supported encoding formats for certificates and keys.
SslProtocol
Describes the protocol of the cipher.
Combined button and popup list for selecting options.
static jboolean copy(JNIEnv *, jobject)
#define QT_WARNING_DISABLE_DEPRECATED
DBusConnection const char DBusError * error
EGLOutputLayerEXT EGLint EGLAttrib value
[5]
#define Q_GLOBAL_STATIC(TYPE, NAME,...)
int qt_subtract_from_timeout(int timeout, int elapsed)
#define qCWarning(category,...)
#define qCDebug(category,...)
static ControlElement< T > * ptr(QWidget *widget)
static bool contains(const QJsonArray &haystack, unsigned needle)
GLenum GLsizei GLuint GLint * bytesWritten
GLint GLenum GLsizei GLsizei GLsizei depth
GLboolean GLboolean GLboolean GLboolean a
[7]
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLenum GLenum GLsizei const GLuint * ids
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLint GLsizei GLsizei GLenum format
GLuint GLuint64EXT address
GLdouble GLdouble GLdouble GLdouble q
GLsizei const GLchar *const * path
static int compare(quint64 a, quint64 b)
QList< QSslCertificate > cert
[0]
bool contains(const AT &t) const noexcept
IUIAutomationTreeWalker __RPC__deref_out_opt IUIAutomationElement ** parent