Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
qqmlsslconfiguration_p.h
Go to the documentation of this file.
1// Copyright (C) 2023 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
3// Qt-Security score:significant reason:default
4
5#ifndef QQMLSSLCONFIGURATION_P_H
6#define QQMLSSLCONFIGURATION_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <qtqmlnetworkexports.h>
20#include "qqmlsslkey_p.h"
21
22#include <QtCore/QByteArray>
23#include <QtCore/QMetaType>
24#include <QtQml/qqml.h>
25#include <QtNetwork/qsslconfiguration.h>
26#include <QtNetwork/qsslsocket.h>
27#include <QtNetwork/qssl.h>
28
30
31class Q_QMLNETWORK_EXPORT QQmlSslConfiguration
32{
33 Q_GADGET
34
35 Q_PROPERTY(QString ciphers READ ciphers WRITE setCiphers)
36#if QT_REMOVAL_QT7_DEPRECATED_SINCE(6, 11)
37 Q_PROPERTY(QList<QSsl::SslOption> sslOptions READ sslOptions WRITE setSslOptions)
38#endif
39 Q_PROPERTY(QSsl::SslProtocol protocol READ protocol WRITE setProtocol)
40 Q_PROPERTY(QSslSocket::PeerVerifyMode peerVerifyMode READ peerVerifyMode
41 WRITE setPeerVerifyMode)
42 Q_PROPERTY(int peerVerifyDepth READ peerVerifyDepth WRITE setPeerVerifyDepth)
43 Q_PROPERTY(QByteArray sessionTicket READ sessionTicket WRITE setSessionTicket)
44 Q_PROPERTY(QSsl::SslOptions sslOptionFlags READ sslOptionFlags WRITE setSslOptionFlags REVISION(6, 11))
45
46public:
47 Q_INVOKABLE void setCertificateFiles(const QStringList &certificateFiles);
48 Q_INVOKABLE void setPrivateKey(const QQmlSslKey &privateKey);
49
50 QString ciphers() const;
51#if QT_REMOVAL_QT7_DEPRECATED_SINCE(6, 11)
52 QT_DEPRECATED_VERSION_X_6_11("Use sslOptionFlags instead.")
53 QList<QSsl::SslOption> sslOptions() const;
54#endif
55 QSsl::SslProtocol protocol() const;
56 QSslSocket::PeerVerifyMode peerVerifyMode() const;
57 int peerVerifyDepth() const;
58 QByteArray sessionTicket() const;
59 QSsl::SslOptions sslOptionFlags() const;
60 QSslConfiguration const configuration();
61
62 void setProtocol(QSsl::SslProtocol protocol);
63 void setPeerVerifyMode(QSslSocket::PeerVerifyMode mode);
64 void setPeerVerifyDepth(int depth);
65 void setCiphers(const QString &ciphers);
66#if QT_REMOVAL_QT7_DEPRECATED_SINCE(6, 11)
67 QT_DEPRECATED_VERSION_X_6_11("Use sslOptionFlags instead.")
68 void setSslOptions(const QList<QSsl::SslOption> &options);
69#endif
70 void setSessionTicket(const QByteArray &sessionTicket);
71 void setSslOptionFlags(QSsl::SslOptions options);
72
73private:
74 inline friend bool operator==(const QQmlSslConfiguration &lval,
75 const QQmlSslConfiguration &rval)
76 {
77 return lval.m_certificateFiles == rval.m_certificateFiles
78 && lval.m_ciphers == rval.m_ciphers
79#if QT_REMOVAL_QT7_DEPRECATED_SINCE(6, 11)
80 && lval.m_sslOptions == rval.m_sslOptions
81#endif
82 && lval.m_configuration == rval.m_configuration;
83 }
84
85 inline friend bool operator!=(const QQmlSslConfiguration &lval,
86 const QQmlSslConfiguration &rval)
87 {
88 return !(lval == rval);
89 }
90
91protected:
92#if QT_REMOVAL_QT7_DEPRECATED_SINCE(6, 11)
93 void setSslOptionsList(const QSslConfiguration &configuration);
94#endif
95 void setCiphersList(const QSslConfiguration &configuration);
96
97 QStringList m_certificateFiles;
98 QString m_ciphers;
99#if QT_REMOVAL_QT7_DEPRECATED_SINCE(6, 11)
100 QList<QSsl::SslOption> m_sslOptions;
101#endif
102 QSslConfiguration m_configuration;
103};
104
105class Q_QMLNETWORK_EXPORT QQmlSslDefaultConfiguration : public QQmlSslConfiguration
106{
107 Q_GADGET
108 QML_NAMED_ELEMENT(sslConfiguration)
109 QML_ADDED_IN_VERSION(6, 7)
110
111public:
112 QQmlSslDefaultConfiguration();
113};
114
115class Q_QMLNETWORK_EXPORT QQmlSslDefaultDtlsConfiguration : public QQmlSslConfiguration
116{
117 Q_GADGET
118 QML_NAMED_ELEMENT(sslDtlsConfiguration)
119 QML_ADDED_IN_VERSION(6, 7)
120
121public:
122 QQmlSslDefaultDtlsConfiguration();
123};
124
125QT_END_NAMESPACE
126
127#endif // QQMLSSLCONFIGURATION_P_H