ssl/qsslcertificateextension.cpp

Source codeSwitch to Preprocessed file
LineSource CodeCoverage
1/**************************************************************************** -
2** -
3** Copyright (C) 2011 Richard J. Moore <rich@kde.org> -
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/*! -
43 \class QSslCertificateExtension -
44 \brief The QSslCertificateExtension class provides an API for accessing the -
45 extensions of an X509 certificate. -
46 \since 5.0 -
47 -
48 \reentrant -
49 \ingroup network -
50 \ingroup ssl -
51 \ingroup shared -
52 \inmodule QtNetwork -
53 -
54 QSslCertificateExtension provides access to an extension stored in -
55 an X509 certificate. The information available depends on the type -
56 of extension being accessed. -
57 -
58 All X509 certificate extensions have the following properties: -
59 -
60 \table -
61 \header -
62 \li Property -
63 \li Description -
64 \row -
65 \li name -
66 \li The human readable name of the extension, eg. 'basicConstraints'. -
67 \row -
68 \li criticality -
69 \li This is a boolean value indicating if the extension is critical -
70 to correctly interpreting the certificate. -
71 \row -
72 \li oid -
73 \li The ASN.1 object identifier that specifies which extension this -
74 is. -
75 \row -
76 \li supported -
77 \li If this is true the structure of the extension's value will not -
78 change between Qt versions. -
79 \row -
80 \li value -
81 \li A QVariant with a structure dependent on the type of extension. -
82 \endtable -
83 -
84 Whilst this class provides access to any type of extension, only -
85 some are guaranteed to be returned in a format that will remain -
86 unchanged between releases. The isSupported() method returns true -
87 for extensions where this is the case. -
88 -
89 The extensions currently supported, and the structure of the value -
90 returned are as follows: -
91 -
92 \table -
93 \header -
94 \li Name -
95 \li OID -
96 \li Details -
97 \row -
98 \li basicConstraints -
99 \li 2.5.29.19 -
100 \li Returned as a QVariantMap. The key 'ca' contains a boolean value, -
101 the optional key 'pathLenConstraint' contains an integer. -
102 \row -
103 \li authorityInfoAccess -
104 \li 1.3.6.1.5.5.7.1.1 -
105 \li Returned as a QVariantMap. There is a key for each access method, -
106 with the value being a URI. -
107 \row -
108 \li subjectKeyIdentifier -
109 \li 2.5.29.14 -
110 \li Returned as a QVariant containing a QString. The string is the key -
111 identifier. -
112 \row -
113 \li authorityKeyIdentifier -
114 \li 2.5.29.35 -
115 \li Returned as a QVariantMap. The optional key 'keyid' contains the key -
116 identifier as a hex string stored in a QByteArray. The optional key -
117 'serial' contains the authority key serial number as a qlonglong. -
118 Currently there is no support for the general names field of this -
119 extension. -
120 \endtable -
121 -
122 In addition to the supported extensions above, many other common extensions -
123 will be returned in a reasonably structured way. Extensions that the SSL -
124 backend has no support for at all will be returned as a QByteArray. -
125 -
126 Further information about the types of extensions certificates can -
127 contain can be found in RFC 5280. -
128 -
129 \sa QSslCertificate::extensions() -
130 */ -
131 -
132#include "qsslcertificateextension.h" -
133#include "qsslcertificateextension_p.h" -
134 -
135QT_BEGIN_NAMESPACE -
136 -
137/*! -
138 Constructs a QSslCertificateExtension. -
139 */ -
140QSslCertificateExtension::QSslCertificateExtension() -
141 : d(new QSslCertificateExtensionPrivate) -
142{ -
143}
executed: }
Execution Count:9
9
144 -
145/*! -
146 Constructs a copy of \a other. -
147 */ -
148QSslCertificateExtension::QSslCertificateExtension(const QSslCertificateExtension &other) -
149 : d(other.d) -
150{ -
151}
executed: }
Execution Count:23
23
152 -
153/*! -
154 Destroys the extension. -
155 */ -
156QSslCertificateExtension::~QSslCertificateExtension() -
157{ -
158} -
159 -
160/*! -
161 Assigns \a other to this extension and returns a reference to this extension. -
162 */ -
163QSslCertificateExtension &QSslCertificateExtension::operator=(const QSslCertificateExtension &other) -
164{ -
165 d = other.d;
never executed (the execution status of this line is deduced): d = other.d;
-
166 return *this;
never executed: return *this;
0
167} -
168 -
169/*! -
170 \fn void QSslCertificateExtension::swap(QSslCertificateExtension &other) -
171 -
172 Swaps this certificate extension instance with \a other. This -
173 function is very fast and never fails. -
174*/ -
175 -
176/*! -
177 Returns the ASN.1 OID of this extension. -
178 */ -
179QString QSslCertificateExtension::oid() const -
180{ -
181 return d->oid;
executed: return d->oid;
Execution Count:14
14
182} -
183 -
184/*! -
185 Returns the name of the extension. If no name is known for the -
186 extension then the OID will be returned. -
187 */ -
188QString QSslCertificateExtension::name() const -
189{ -
190 return d->name;
executed: return d->name;
Execution Count:41
41
191} -
192 -
193/*! -
194 Returns the value of the extension. The structure of the value -
195 returned depends on the extension type. -
196 */ -
197QVariant QSslCertificateExtension::value() const -
198{ -
199 return d->value;
executed: return d->value;
Execution Count:5
5
200} -
201 -
202/*! -
203 Returns the criticality of the extension. -
204 */ -
205bool QSslCertificateExtension::isCritical() const -
206{ -
207 return d->critical;
never executed: return d->critical;
0
208} -
209 -
210/*! -
211 Returns the true if this extension is supported. In this case, -
212 supported simply means that the structure of the QVariant returned -
213 by the value() accessor will remain unchanged between versions. -
214 Unsupported extensions can be freely used, however there is no -
215 guarantee that the returned data will have the same structure -
216 between versions. -
217 */ -
218bool QSslCertificateExtension::isSupported() const -
219{ -
220 return d->supported;
never executed: return d->supported;
0
221} -
222 -
223QT_END_NAMESPACE -
224 -
Source codeSwitch to Preprocessed file

Generated by Squish Coco Non-Commercial