Qt 4.8
qsslcipher.cpp
Go to the documentation of this file.
1 /****************************************************************************
2 **
3 ** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4 ** Contact: http://www.qt-project.org/legal
5 **
6 ** This file is part of the QtNetwork module of the Qt Toolkit.
7 **
8 ** $QT_BEGIN_LICENSE:LGPL$
9 ** Commercial License Usage
10 ** Licensees holding valid commercial Qt licenses may use this file in
11 ** accordance with the commercial license agreement provided with the
12 ** Software or, alternatively, in accordance with the terms contained in
13 ** a written agreement between you and Digia. For licensing terms and
14 ** conditions see http://qt.digia.com/licensing. For further information
15 ** use the contact form at http://qt.digia.com/contact-us.
16 **
17 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Digia gives you certain additional
26 ** rights. These rights are described in the Digia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** GNU General Public License Usage
30 ** Alternatively, this file may be used under the terms of the GNU
31 ** General Public License version 3.0 as published by the Free Software
32 ** Foundation and appearing in the file LICENSE.GPL included in the
33 ** packaging of this file. Please review the following information to
34 ** ensure the GNU General Public License version 3.0 requirements will be
35 ** met: http://www.gnu.org/copyleft/gpl.html.
36 **
37 **
38 ** $QT_END_LICENSE$
39 **
40 ****************************************************************************/
41 
42 
64 #include "qsslcipher.h"
65 #include "qsslcipher_p.h"
66 #include "qsslsocket.h"
67 
68 #ifndef QT_NO_DEBUG_STREAM
69 #include <QtCore/qdebug.h>
70 #endif
71 
73 
78  : d(new QSslCipherPrivate)
79 {
80 }
81 
93  : d(new QSslCipherPrivate)
94 {
95  foreach (const QSslCipher &cipher, QSslSocket::supportedCiphers()) {
96  if (cipher.name() == name && cipher.protocol() == protocol) {
97  *this = cipher;
98  return;
99  }
100  }
101 }
102 
107  : d(new QSslCipherPrivate)
108 {
109  *d.data() = *other.d.data();
110 }
111 
116 {
117 }
118 
124 {
125  *d.data() = *other.d.data();
126  return *this;
127 }
128 
133 bool QSslCipher::operator==(const QSslCipher &other) const
134 {
135  return d->name == other.d->name && d->protocol == other.d->protocol;
136 }
137 
151 bool QSslCipher::isNull() const
152 {
153  return d->isNull;
154 }
155 
163 {
164  return d->name;
165 }
166 
173 {
174  return d->supportedBits;
175 }
176 
183 {
184  return d->bits;
185 }
186 
191 {
192  return d->keyExchangeMethod;
193 }
194 
199 {
200  return d->authenticationMethod;
201 }
202 
207 {
208  return d->encryptionMethod;
209 }
210 
217 {
218  return d->protocolString;
219 }
220 
229 {
230  return d->protocol;
231 }
232 
233 #ifndef QT_NO_DEBUG_STREAM
234 QDebug operator<<(QDebug debug, const QSslCipher &cipher)
235 {
236  debug << "QSslCipher(name=" << qPrintable(cipher.name())
237  << ", bits=" << cipher.usedBits()
238  << ", proto=" << qPrintable(cipher.protocolString())
239  << ')';
240  return debug;
241 }
242 #endif
243 
int supportedBits() const
Returns the number of bits supported by the cipher.
Definition: qsslcipher.cpp:172
The QDebug class provides an output stream for debugging information.
Definition: qdebug.h:62
double d
Definition: qnumeric_p.h:62
QString protocolString() const
Returns the cipher&#39;s protocol as a QString.
Definition: qsslcipher.cpp:216
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
T * data() const
Returns the value of the pointer referenced by this object.
QString keyExchangeMethod() const
Returns the cipher&#39;s key exchange method as a QString.
Definition: qsslcipher.cpp:190
The QString class provides a Unicode character string.
Definition: qstring.h:83
QSsl::SslProtocol protocol() const
Returns the cipher&#39;s protocol type, or QSsl::UnknownProtocol if QSslCipher is unable to determine the...
Definition: qsslcipher.cpp:228
QString authenticationMethod() const
Returns the cipher&#39;s authentication method as a QString.
Definition: qsslcipher.cpp:198
The QSslCipher class represents an SSL cryptographic cipher.
Definition: qsslcipher.h:59
QString encryptionMethod
Definition: qsslcipher_p.h:72
bool operator==(const QSslCipher &other) const
Returns true if this cipher is the same as other; otherwise, false is returned.
Definition: qsslcipher.cpp:133
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
SslProtocol
Describes the protocol of the cipher.
Definition: qssl.h:76
QSslCipher()
Constructs an empty QSslCipher object.
Definition: qsslcipher.cpp:77
QScopedPointer< QSslCipherPrivate > d
Definition: qsslcipher.h:82
static QList< QSslCipher > supportedCiphers()
Returns the list of cryptographic ciphers supported by this system.
QString name() const
Returns the name of the cipher, or an empty QString if this is a null cipher.
Definition: qsslcipher.cpp:162
QSslCipher & operator=(const QSslCipher &other)
Copies the contents of other into this cipher, making the two ciphers identical.
Definition: qsslcipher.cpp:123
QSsl::SslProtocol protocol
Definition: qsslcipher_p.h:75
int usedBits() const
Returns the number of bits used by the cipher.
Definition: qsslcipher.cpp:182
bool isNull() const
Returns true if this is a null cipher; otherwise returns false.
Definition: qsslcipher.cpp:151
~QSslCipher()
Destroys the QSslCipher object.
Definition: qsslcipher.cpp:115
QString encryptionMethod() const
Returns the cipher&#39;s encryption method as a QString.
Definition: qsslcipher.cpp:206
QString keyExchangeMethod
Definition: qsslcipher_p.h:70
#define qPrintable(string)
Definition: qglobal.h:1750
QDebug operator<<(QDebug debug, const QSslCipher &cipher)
Definition: qsslcipher.cpp:234
QString protocolString
Definition: qsslcipher_p.h:74
QString authenticationMethod
Definition: qsslcipher_p.h:71