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
qsslcipher.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 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
4
24#include "qsslcipher.h"
25#include "qsslcipher_p.h"
26#include "qsslsocket.h"
27#include "qsslconfiguration.h"
28
29#ifndef QT_NO_DEBUG_STREAM
30#include <QtCore/qdebug.h>
31#endif
32
34
35static_assert(QT_VERSION < QT_VERSION_CHECK(7, 0, 0)
36 && sizeof(QScopedPointer<QSslCipherPrivate>) == sizeof(std::unique_ptr<QSslCipherPrivate>));
37
45
58 : d(new QSslCipherPrivate)
59{
60 const auto ciphers = QSslConfiguration::supportedCiphers();
61 for (const QSslCipher &cipher : ciphers) {
62 if (cipher.name() == name) {
63 *this = cipher;
64 return;
65 }
66 }
67}
68
80 : d(new QSslCipherPrivate)
81{
82 const auto ciphers = QSslConfiguration::supportedCiphers();
83 for (const QSslCipher &cipher : ciphers) {
84 if (cipher.name() == name && cipher.protocol() == protocol) {
85 *this = cipher;
86 return;
87 }
88 }
89}
90
95 : d(new QSslCipherPrivate)
96{
97 *d.get() = *other.d.get();
98}
99
106
112{
113 *d.get() = *other.d.get();
114 return *this;
115}
116
130{
131 return d->name == other.d->name && d->protocol == other.d->protocol;
132}
133
145{
146 return d->isNull;
147}
148
156{
157 return d->name;
158}
159
166{
167 return d->supportedBits;
168}
169
176{
177 return d->bits;
178}
179
184{
185 return d->keyExchangeMethod;
186}
187
192{
193 return d->authenticationMethod;
194}
195
200{
201 return d->encryptionMethod;
202}
203
210{
211 return d->protocolString;
212}
213
222{
223 return d->protocol;
224}
225
226#ifndef QT_NO_DEBUG_STREAM
228{
229 QDebugStateSaver saver(debug);
230 debug.resetFormat().nospace().noquote();
231 debug << "QSslCipher(name=" << cipher.name()
232 << ", bits=" << cipher.usedBits()
233 << ", proto=" << cipher.protocolString()
234 << ')';
235 return debug;
236}
237#endif
238
\inmodule QtCore
\inmodule QtCore
The QSslCipher class represents an SSL cryptographic cipher.
Definition qsslcipher.h:22
QSslCipher()
Constructs an empty QSslCipher object.
QString keyExchangeMethod() const
Returns the cipher's key exchange method as a QString.
QString name() const
Returns the name of the cipher, or an empty QString if this is a null cipher.
QSslCipher & operator=(QSslCipher &&other) noexcept
Definition qsslcipher.h:28
int usedBits() const
Returns the number of bits used by the cipher.
~QSslCipher()
Destroys the QSslCipher object.
QSsl::SslProtocol protocol() const
Returns the cipher's protocol type, or \l QSsl::UnknownProtocol if QSslCipher is unable to determine ...
int supportedBits() const
Returns the number of bits supported by the cipher.
bool isNull() const
Returns true if this is a null cipher; otherwise returns false.
QString encryptionMethod() const
Returns the cipher's encryption method as a QString.
QString authenticationMethod() const
Returns the cipher's authentication method as a QString.
QString protocolString() const
Returns the cipher's protocol as a QString.
bool operator==(const QSslCipher &other) const
Returns true if this cipher is the same as other; otherwise, false is returned.
static QList< QSslCipher > supportedCiphers()
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
SslProtocol
Describes the protocol of the cipher.
Definition qssl.h:50
Combined button and popup list for selecting options.
GLuint name
QDebug operator<<(QDebug debug, const QSslCipher &cipher)
#define QT_VERSION_CHECK(major, minor, patch)
#define QT_VERSION
QSharedPointer< T > other(t)
[5]