1// Copyright (C) 2016 The Qt Company Ltd.
2// Copyright (C) 2014 BlackBerry Limited. All rights reserved.
3// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
4// Qt-Security score:significant reason:default
5
6/****************************************************************************
7**
8** In addition, as a special exception, the copyright holders listed above give
9** permission to link the code of its release of Qt with the OpenSSL project's
10** "OpenSSL" library (or modified versions of the "OpenSSL" library that use the
11** same license as the original version), and distribute the linked executables.
12**
13** You must comply with the GNU General Public License version 2 in all
14** respects for all of the code used other than the "OpenSSL" code. If you
15** modify this file, you may extend this exception to your version of the file,
16** but you are not obligated to do so. If you do not wish to do so, delete
17** this exception statement from your version of this file.
18**
19****************************************************************************/
20
21#ifndef QSSLCONFIGURATION_P_H
22#define QSSLCONFIGURATION_P_H
23
24//
25// W A R N I N G
26// -------------
27//
28// This file is not part of the Qt API. It exists for the convenience
29// of the QSslSocket API. This header file may change from
30// version to version without notice, or even be removed.
31//
32// We mean it.
33//
34
35#include <QtCore/qmap.h>
36#include <QtNetwork/private/qtnetworkglobal_p.h>
37#include "qsslconfiguration.h"
38#include "qlist.h"
39#include "qsslcertificate.h"
40#include "qsslcipher.h"
41#include "qsslkey.h"
42#include "qsslellipticcurve.h"
43#include "qssldiffiehellmanparameters.h"
44
45QT_BEGIN_NAMESPACE
46
47class QSslConfigurationPrivate: public QSharedData
48{
49public:
50 QSslConfigurationPrivate()
51 : sessionProtocol(QSsl::UnknownProtocol),
52 protocol(QSsl::SecureProtocols),
53 peerVerifyMode(QSslSocket::AutoVerifyPeer),
54 peerVerifyDepth(0),
55 allowRootCertOnDemandLoading(true),
56 peerSessionShared(false),
57 sslOptions(QSslConfigurationPrivate::defaultSslOptions),
58 dhParams(QSslDiffieHellmanParameters::defaultParameters()),
59 sslSessionTicketLifeTimeHint(-1),
60 ephemeralServerKey(),
61 preSharedKeyIdentityHint(),
62 nextProtocolNegotiationStatus(QSslConfiguration::NextProtocolNegotiationNone)
63 { }
64
65 QSslCertificate peerCertificate;
66 QList<QSslCertificate> peerCertificateChain;
67
68 QList<QSslCertificate> localCertificateChain;
69
70 QSslKey privateKey;
71 QSslCipher sessionCipher;
72 QSsl::SslProtocol sessionProtocol;
73 QList<QSslCipher> ciphers;
74 QList<QSslCertificate> caCertificates;
75
76 QSsl::SslProtocol protocol;
77 QSslSocket::PeerVerifyMode peerVerifyMode;
78 int peerVerifyDepth;
79 bool allowRootCertOnDemandLoading;
80 bool peerSessionShared;
81
82 Q_AUTOTEST_EXPORT static bool peerSessionWasShared(const QSslConfiguration &configuration);
83
84 QSsl::SslOptions sslOptions;
85
86 static const QSsl::SslOptions defaultSslOptions;
87
88 QList<QSslEllipticCurve> ellipticCurves;
89
90 QSslDiffieHellmanParameters dhParams;
91
92 QMap<QByteArray, QVariant> backendConfig;
93
94 QByteArray sslSession;
95 int sslSessionTicketLifeTimeHint;
96
97 QSslKey ephemeralServerKey;
98
99 QByteArray preSharedKeyIdentityHint;
100
101 QList<QByteArray> nextAllowedProtocols;
102 QByteArray nextNegotiatedProtocol;
103 QSslConfiguration::NextProtocolNegotiationStatus nextProtocolNegotiationStatus;
104
105#if QT_CONFIG(dtls)
106 bool dtlsCookieEnabled = true;
107#else
108 const bool dtlsCookieEnabled = false;
109#endif // dtls
110
111#if QT_CONFIG(ocsp)
112 bool ocspStaplingEnabled = false;
113#else
114 const bool ocspStaplingEnabled = false;
115#endif
116
117#if QT_CONFIG(openssl)
118 bool reportFromCallback = false;
119 bool missingCertIsFatal = false;
120#else
121 const bool reportFromCallback = false;
122 const bool missingCertIsFatal = false;
123#endif // openssl
124
125 // in qsslsocket.cpp:
126 static QSslConfiguration defaultConfiguration();
127 static void setDefaultConfiguration(const QSslConfiguration &configuration);
128 static void deepCopyDefaultConfiguration(QSslConfigurationPrivate *config);
129
130 static QSslConfiguration defaultDtlsConfiguration();
131 static void setDefaultDtlsConfiguration(const QSslConfiguration &configuration);
132};
133
134// implemented here for inlining purposes
135inline QSslConfiguration::QSslConfiguration(QSslConfigurationPrivate *dd)
136 : d(dd)
137{
138}
139
140QT_END_NAMESPACE
141
142#endif
143

source code of qtbase/src/network/ssl/qsslconfiguration_p.h