Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qtls_st_p.h
Go to the documentation of this file.
1// Copyright (C) 2014 Jeremy Lainé <jeremy.laine@m4x.org>
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3
4#ifndef QTLS_ST_P_H
5#define QTLS_ST_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists for the convenience
12// of the QtNetwork library. This header file may change from
13// version to version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtNetwork/private/qtnetworkglobal_p.h>
19
20#include "qtlsbackend_st_p.h"
21
22#include <QtCore/qobject.h>
23#include <QtCore/qstring.h>
24#include <QtCore/qglobal.h>
25#include <QtCore/qlist.h>
26
27#include <QtNetwork/qabstractsocket.h>
28#include <QtNetwork/private/qsslsocket_p.h>
29
30#warning SecureTransport was deprecated in macOS 10.15 and iOS 13, \
31and is no longer supported. We should be using Network.framework instead. \
32See QTBUG-85231 for more information.
34
35#include <Security/Security.h>
36#include <Security/SecureTransport.h>
37
39
40namespace QTlsPrivate {
41
43{
44public:
45 explicit QSecureTransportContext(SSLContextRef context);
47
48 operator SSLContextRef () const;
49 void reset(SSLContextRef newContext);
50private:
51 SSLContextRef context;
52
53 Q_DISABLE_COPY_MOVE(QSecureTransportContext)
54};
55
56class TlsCryptographSecureTransport : public TlsCryptograph
57{
58public:
61
62 void init(QSslSocket *qObj, QSslSocketPrivate *dObj) override;
63 void continueHandshake() override;
64 void disconnected() override;
65 void disconnectFromHost() override;
66 QSslCipher sessionCipher() const override;
67 QSsl::SslProtocol sessionProtocol() const override;
68 void startClientEncryption() override;
69 void startServerEncryption() override;
70 void transmit() override;
71 QList<QSslError> tlsErrors() const override;
72
73 SSLCipherSuite SSLCipherSuite_from_QSslCipher(const QSslCipher &ciph);
74
75private:
76 // SSL context management/properties:
77 bool initSslContext();
78 void destroySslContext();
79 bool setSessionCertificate(QString &errorDescription,
81 bool setSessionProtocol();
82 // Aux. functions to do a verification during handshake phase:
83 bool canIgnoreTrustVerificationFailure() const;
84 bool verifySessionProtocol() const;
85 bool verifyPeerTrust();
86
87 bool checkSslErrors();
88 bool startHandshake();
89
90 bool isHandshakeComplete() const;
91
92 // IO callbacks:
93 static OSStatus ReadCallback(TlsCryptographSecureTransport *socket, char *data, size_t *dataLength);
94 static OSStatus WriteCallback(TlsCryptographSecureTransport *plainSocket, const char *data, size_t *dataLength);
95
97 bool renegotiating = false;
98 QSslSocket *q = nullptr;
99 QSslSocketPrivate *d = nullptr;
100 bool shutdown = false;
101 QList<QSslError> sslErrors;
102
103 Q_DISABLE_COPY_MOVE(TlsCryptographSecureTransport)
104};
105
106} // namespace QTlsPrivate
107
109
110#endif // QTLS_ST_P_H
SocketError
This enum describes the socket errors that can occur.
The QSslCipher class represents an SSL cryptographic cipher.
Definition qsslcipher.h:22
The QSslSocket class provides an SSL encrypted socket for both clients and servers.
Definition qsslsocket.h:29
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
QSecureTransportContext(SSLContextRef context)
Definition qtls_st.cpp:177
QSslCipher sessionCipher() const override
Definition qtls_st.cpp:383
QList< QSslError > tlsErrors() const override
Definition qtls_st.cpp:1314
void init(QSslSocket *qObj, QSslSocketPrivate *dObj) override
Definition qtls_st.cpp:298
QSsl::SslProtocol sessionProtocol() const override
Definition qtls_st.cpp:392
SSLCipherSuite SSLCipherSuite_from_QSslCipher(const QSslCipher &ciph)
Definition qtls_st.cpp:539
SslProtocol
Describes the protocol of the cipher.
Definition qssl.h:50
Combined button and popup list for selecting options.
Namespace containing onternal types that TLS backends implement.
#define QT_WARNING_DISABLE_DEPRECATED
GLint GLsizei GLsizei GLenum GLenum GLsizei void * data
GLboolean reset
GLdouble GLdouble GLdouble GLdouble q
Definition qopenglext.h:259
QTcpSocket * socket
[1]