Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/network/ssl/qsslcertificateextension.cpp |
Source code | Switch to Preprocessed file |
Line | Source | Count |
---|---|---|
1 | /**************************************************************************** | - |
2 | ** | - |
3 | ** Copyright (C) 2011 Richard J. Moore <rich@kde.org> | - |
4 | ** Contact: https://www.qt.io/licensing/ | - |
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 The Qt Company. For licensing terms | - |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further | - |
15 | ** information use the contact form at https://www.qt.io/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 3 as published by the Free Software | - |
20 | ** Foundation and appearing in the file LICENSE.LGPL3 included in the | - |
21 | ** packaging of this file. Please review the following information to | - |
22 | ** ensure the GNU Lesser General Public License version 3 requirements | - |
23 | ** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. | - |
24 | ** | - |
25 | ** GNU General Public License Usage | - |
26 | ** Alternatively, this file may be used under the terms of the GNU | - |
27 | ** General Public License version 2.0 or (at your option) the GNU General | - |
28 | ** Public license version 3 or any later version approved by the KDE Free | - |
29 | ** Qt Foundation. The licenses are as published by the Free Software | - |
30 | ** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 | - |
31 | ** included in the packaging of this file. Please review the following | - |
32 | ** information to ensure the GNU General Public License requirements will | - |
33 | ** be met: https://www.gnu.org/licenses/gpl-2.0.html and | - |
34 | ** https://www.gnu.org/licenses/gpl-3.0.html. | - |
35 | ** | - |
36 | ** $QT_END_LICENSE$ | - |
37 | ** | - |
38 | ****************************************************************************/ | - |
39 | - | |
40 | /*! | - |
41 | \class QSslCertificateExtension | - |
42 | \brief The QSslCertificateExtension class provides an API for accessing the | - |
43 | extensions of an X509 certificate. | - |
44 | \since 5.0 | - |
45 | - | |
46 | \reentrant | - |
47 | \ingroup network | - |
48 | \ingroup ssl | - |
49 | \ingroup shared | - |
50 | \inmodule QtNetwork | - |
51 | - | |
52 | QSslCertificateExtension provides access to an extension stored in | - |
53 | an X509 certificate. The information available depends on the type | - |
54 | of extension being accessed. | - |
55 | - | |
56 | All X509 certificate extensions have the following properties: | - |
57 | - | |
58 | \table | - |
59 | \header | - |
60 | \li Property | - |
61 | \li Description | - |
62 | \row | - |
63 | \li name | - |
64 | \li The human readable name of the extension, eg. 'basicConstraints'. | - |
65 | \row | - |
66 | \li criticality | - |
67 | \li This is a boolean value indicating if the extension is critical | - |
68 | to correctly interpreting the certificate. | - |
69 | \row | - |
70 | \li oid | - |
71 | \li The ASN.1 object identifier that specifies which extension this | - |
72 | is. | - |
73 | \row | - |
74 | \li supported | - |
75 | \li If this is true the structure of the extension's value will not | - |
76 | change between Qt versions. | - |
77 | \row | - |
78 | \li value | - |
79 | \li A QVariant with a structure dependent on the type of extension. | - |
80 | \endtable | - |
81 | - | |
82 | Whilst this class provides access to any type of extension, only | - |
83 | some are guaranteed to be returned in a format that will remain | - |
84 | unchanged between releases. The isSupported() method returns \c true | - |
85 | for extensions where this is the case. | - |
86 | - | |
87 | The extensions currently supported, and the structure of the value | - |
88 | returned are as follows: | - |
89 | - | |
90 | \table | - |
91 | \header | - |
92 | \li Name | - |
93 | \li OID | - |
94 | \li Details | - |
95 | \row | - |
96 | \li basicConstraints | - |
97 | \li 2.5.29.19 | - |
98 | \li Returned as a QVariantMap. The key 'ca' contains a boolean value, | - |
99 | the optional key 'pathLenConstraint' contains an integer. | - |
100 | \row | - |
101 | \li authorityInfoAccess | - |
102 | \li 1.3.6.1.5.5.7.1.1 | - |
103 | \li Returned as a QVariantMap. There is a key for each access method, | - |
104 | with the value being a URI. | - |
105 | \row | - |
106 | \li subjectKeyIdentifier | - |
107 | \li 2.5.29.14 | - |
108 | \li Returned as a QVariant containing a QString. The string is the key | - |
109 | identifier. | - |
110 | \row | - |
111 | \li authorityKeyIdentifier | - |
112 | \li 2.5.29.35 | - |
113 | \li Returned as a QVariantMap. The optional key 'keyid' contains the key | - |
114 | identifier as a hex string stored in a QByteArray. The optional key | - |
115 | 'serial' contains the authority key serial number as a qlonglong. | - |
116 | Currently there is no support for the general names field of this | - |
117 | extension. | - |
118 | \endtable | - |
119 | - | |
120 | In addition to the supported extensions above, many other common extensions | - |
121 | will be returned in a reasonably structured way. Extensions that the SSL | - |
122 | backend has no support for at all will be returned as a QByteArray. | - |
123 | - | |
124 | Further information about the types of extensions certificates can | - |
125 | contain can be found in RFC 5280. | - |
126 | - | |
127 | \sa QSslCertificate::extensions() | - |
128 | */ | - |
129 | - | |
130 | #include "qsslcertificateextension.h" | - |
131 | #include "qsslcertificateextension_p.h" | - |
132 | - | |
133 | QT_BEGIN_NAMESPACE | - |
134 | - | |
135 | /*! | - |
136 | Constructs a QSslCertificateExtension. | - |
137 | */ | - |
138 | QSslCertificateExtension::QSslCertificateExtension() | - |
139 | : d(new QSslCertificateExtensionPrivate) | - |
140 | { | - |
141 | } executed 18 times by 1 test: end of block Executed by:
| 18 |
142 | - | |
143 | /*! | - |
144 | Constructs a copy of \a other. | - |
145 | */ | - |
146 | QSslCertificateExtension::QSslCertificateExtension(const QSslCertificateExtension &other) | - |
147 | : d(other.d) | - |
148 | { | - |
149 | } executed 43 times by 1 test: end of block Executed by:
| 43 |
150 | - | |
151 | /*! | - |
152 | Destroys the extension. | - |
153 | */ | - |
154 | QSslCertificateExtension::~QSslCertificateExtension() | - |
155 | { | - |
156 | } | - |
157 | - | |
158 | /*! | - |
159 | Assigns \a other to this extension and returns a reference to this extension. | - |
160 | */ | - |
161 | QSslCertificateExtension &QSslCertificateExtension::operator=(const QSslCertificateExtension &other) | - |
162 | { | - |
163 | d = other.d; | - |
164 | return *this; never executed: return *this; | 0 |
165 | } | - |
166 | - | |
167 | /*! | - |
168 | \fn void QSslCertificateExtension::swap(QSslCertificateExtension &other) | - |
169 | - | |
170 | Swaps this certificate extension instance with \a other. This | - |
171 | function is very fast and never fails. | - |
172 | */ | - |
173 | - | |
174 | /*! | - |
175 | Returns the ASN.1 OID of this extension. | - |
176 | */ | - |
177 | QString QSslCertificateExtension::oid() const | - |
178 | { | - |
179 | return d->oid; executed 16 times by 1 test: return d->oid; Executed by:
| 16 |
180 | } | - |
181 | - | |
182 | /*! | - |
183 | Returns the name of the extension. If no name is known for the | - |
184 | extension then the OID will be returned. | - |
185 | */ | - |
186 | QString QSslCertificateExtension::name() const | - |
187 | { | - |
188 | return d->name; executed 61 times by 1 test: return d->name; Executed by:
| 61 |
189 | } | - |
190 | - | |
191 | /*! | - |
192 | Returns the value of the extension. The structure of the value | - |
193 | returned depends on the extension type. | - |
194 | */ | - |
195 | QVariant QSslCertificateExtension::value() const | - |
196 | { | - |
197 | return d->value; executed 6 times by 1 test: return d->value; Executed by:
| 6 |
198 | } | - |
199 | - | |
200 | /*! | - |
201 | Returns the criticality of the extension. | - |
202 | */ | - |
203 | bool QSslCertificateExtension::isCritical() const | - |
204 | { | - |
205 | return d->critical; executed 7 times by 1 test: return d->critical; Executed by:
| 7 |
206 | } | - |
207 | - | |
208 | /*! | - |
209 | Returns the true if this extension is supported. In this case, | - |
210 | supported simply means that the structure of the QVariant returned | - |
211 | by the value() accessor will remain unchanged between versions. | - |
212 | Unsupported extensions can be freely used, however there is no | - |
213 | guarantee that the returned data will have the same structure | - |
214 | between versions. | - |
215 | */ | - |
216 | bool QSslCertificateExtension::isSupported() const | - |
217 | { | - |
218 | return d->supported; executed 7 times by 1 test: return d->supported; Executed by:
| 7 |
219 | } | - |
220 | - | |
221 | QT_END_NAMESPACE | - |
Source code | Switch to Preprocessed file |