annotate ui/certificate.h @ 1296:13b56e9c7e7b

(issue149) licenses/README.txt additions and corrections.
author Bernhard Reiter <bernhard@intevation.de>
date Mon, 29 Sep 2014 16:12:47 +0200
parents 265583011f24
children
rev   line source
404
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 386
diff changeset
1 /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 386
diff changeset
2 * Software engineering by Intevation GmbH
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 386
diff changeset
3 *
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 386
diff changeset
4 * This file is Free Software under the GNU GPL (v>=2)
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 386
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY!
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 386
diff changeset
6 * See LICENSE.txt for details.
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 386
diff changeset
7 */
21
dc1e1e9e62ce Add certificate class and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
8 #ifndef CERTIFICATE_H
dc1e1e9e62ce Add certificate class and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
9 #define CERTIFICATE_H
dc1e1e9e62ce Add certificate class and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
10 /**
dc1e1e9e62ce Add certificate class and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
11 * @file certificate.h
dc1e1e9e62ce Add certificate class and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
12 * @brief Class around native certificates.
dc1e1e9e62ce Add certificate class and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
13 *
dc1e1e9e62ce Add certificate class and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
14 */
dc1e1e9e62ce Add certificate class and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
15
dc1e1e9e62ce Add certificate class and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
16 #include <QByteArray>
338
64e38886f903 Use certhelp for certificate parsing and add some dummy info
Andre Heinecke <aheinecke@intevation.de>
parents: 265
diff changeset
17 #include <QDateTime>
186
2551ad24d3c2 Get subject from the certificate and parse it's attributes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 94
diff changeset
18 #include <QMap>
21
dc1e1e9e62ce Add certificate class and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
19 #include <QString>
dc1e1e9e62ce Add certificate class and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
20
dc1e1e9e62ce Add certificate class and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
21 #ifdef Q_OS_WIN
dc1e1e9e62ce Add certificate class and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
22 #include <windows.h>
dc1e1e9e62ce Add certificate class and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
23 #include <wincrypt.h>
dc1e1e9e62ce Add certificate class and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
24 #endif
dc1e1e9e62ce Add certificate class and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
25
1255
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1108
diff changeset
26 /** @brief Object representation of a single certificate
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1108
diff changeset
27 *
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1108
diff changeset
28 * This parses a PEM (base64 encoded der certificate) and
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1108
diff changeset
29 * provides accessors to the parsed certificate information
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1108
diff changeset
30 * together with meta information about the certificate as
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1108
diff changeset
31 * it is used by the Application.
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1108
diff changeset
32 */
21
dc1e1e9e62ce Add certificate class and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
33 class Certificate
dc1e1e9e62ce Add certificate class and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
34 {
dc1e1e9e62ce Add certificate class and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
35 public:
94
f1ebab8639dc Do not save the x509 cert as a member variable
Andre Heinecke <aheinecke@intevation.de>
parents: 83
diff changeset
36
1255
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1108
diff changeset
37 /**
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1108
diff changeset
38 * @enum Status
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1108
diff changeset
39 * @brief the Status compared to the last installed list. */
265
ffd47b045d19 Added certificate status enum and register it as metatype.
Raimund Renkert <rrenkert@intevation.de>
parents: 248
diff changeset
40 enum Status {
1255
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1108
diff changeset
41 /*! Never seen this before */ InstallNew = 1,
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1108
diff changeset
42 /*! Already contained in last list */ InstallOld,
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1108
diff changeset
43 /*! Was an Install certificate in the last list */ RemoveNew,
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1108
diff changeset
44 /*! Already removed in the last list */ RemoveOld
265
ffd47b045d19 Added certificate status enum and register it as metatype.
Raimund Renkert <rrenkert@intevation.de>
parents: 248
diff changeset
45 };
ffd47b045d19 Added certificate status enum and register it as metatype.
Raimund Renkert <rrenkert@intevation.de>
parents: 248
diff changeset
46
83
ba8a548ff252 Expand certificate class to make raw data accessible
Andre Heinecke <aheinecke@intevation.de>
parents: 82
diff changeset
47 /** @brief construct a certificate from a line of a certificate list.
ba8a548ff252 Expand certificate class to make raw data accessible
Andre Heinecke <aheinecke@intevation.de>
parents: 82
diff changeset
48 *
ba8a548ff252 Expand certificate class to make raw data accessible
Andre Heinecke <aheinecke@intevation.de>
parents: 82
diff changeset
49 * The first two characters of the string are expected to be
ba8a548ff252 Expand certificate class to make raw data accessible
Andre Heinecke <aheinecke@intevation.de>
parents: 82
diff changeset
50 * the command. I: or R:
ba8a548ff252 Expand certificate class to make raw data accessible
Andre Heinecke <aheinecke@intevation.de>
parents: 82
diff changeset
51 *
ba8a548ff252 Expand certificate class to make raw data accessible
Andre Heinecke <aheinecke@intevation.de>
parents: 82
diff changeset
52 * @param[in] b64Line The line from the certificate list.
21
dc1e1e9e62ce Add certificate class and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
53 **/
94
f1ebab8639dc Do not save the x509 cert as a member variable
Andre Heinecke <aheinecke@intevation.de>
parents: 83
diff changeset
54 Certificate(const QString& b64Line = QString());
21
dc1e1e9e62ce Add certificate class and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
55
349
a49766196a7d Add certificateFromFile method
Andre Heinecke <andre.heinecke@intevation.de>
parents: 341
diff changeset
56 /** @brief construct a certificate from a byte array of DER data
a49766196a7d Add certificateFromFile method
Andre Heinecke <andre.heinecke@intevation.de>
parents: 341
diff changeset
57 *
a49766196a7d Add certificateFromFile method
Andre Heinecke <andre.heinecke@intevation.de>
parents: 341
diff changeset
58 * @param[in] derData a der encoded certificate.
a49766196a7d Add certificateFromFile method
Andre Heinecke <andre.heinecke@intevation.de>
parents: 341
diff changeset
59 **/
a49766196a7d Add certificateFromFile method
Andre Heinecke <andre.heinecke@intevation.de>
parents: 341
diff changeset
60 Certificate(const QByteArray& derData);
a49766196a7d Add certificateFromFile method
Andre Heinecke <andre.heinecke@intevation.de>
parents: 341
diff changeset
61
21
dc1e1e9e62ce Add certificate class and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
62 /** @brief check if this certificate could be parsed */
78
2f5db8c70bc2 Constify
Andre Heinecke <aheinecke@intevation.de>
parents: 21
diff changeset
63 bool isValid() const {return mValid;}
21
dc1e1e9e62ce Add certificate class and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
64
dc1e1e9e62ce Add certificate class and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
65 /** @brief get a short description of the certificate
dc1e1e9e62ce Add certificate class and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
66 *
dc1e1e9e62ce Add certificate class and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
67 * This description should be used as a short overview
dc1e1e9e62ce Add certificate class and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
68 * for this certificate
dc1e1e9e62ce Add certificate class and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
69 *
dc1e1e9e62ce Add certificate class and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
70 **/
186
2551ad24d3c2 Get subject from the certificate and parse it's attributes
Andre Heinecke <andre.heinecke@intevation.de>
parents: 94
diff changeset
71 QString shortDescription() const;
83
ba8a548ff252 Expand certificate class to make raw data accessible
Andre Heinecke <aheinecke@intevation.de>
parents: 82
diff changeset
72
ba8a548ff252 Expand certificate class to make raw data accessible
Andre Heinecke <aheinecke@intevation.de>
parents: 82
diff changeset
73 /** @brief get details for the certificate
ba8a548ff252 Expand certificate class to make raw data accessible
Andre Heinecke <aheinecke@intevation.de>
parents: 82
diff changeset
74 *
338
64e38886f903 Use certhelp for certificate parsing and add some dummy info
Andre Heinecke <aheinecke@intevation.de>
parents: 265
diff changeset
75 * Get a formatted details string usable for user visible
64e38886f903 Use certhelp for certificate parsing and add some dummy info
Andre Heinecke <aheinecke@intevation.de>
parents: 265
diff changeset
76 * certificate details.
83
ba8a548ff252 Expand certificate class to make raw data accessible
Andre Heinecke <aheinecke@intevation.de>
parents: 82
diff changeset
77 *
ba8a548ff252 Expand certificate class to make raw data accessible
Andre Heinecke <aheinecke@intevation.de>
parents: 82
diff changeset
78 **/
ba8a548ff252 Expand certificate class to make raw data accessible
Andre Heinecke <aheinecke@intevation.de>
parents: 82
diff changeset
79 const QString& details() const {return mDetails;}
ba8a548ff252 Expand certificate class to make raw data accessible
Andre Heinecke <aheinecke@intevation.de>
parents: 82
diff changeset
80
ba8a548ff252 Expand certificate class to make raw data accessible
Andre Heinecke <aheinecke@intevation.de>
parents: 82
diff changeset
81 /** @brief get the line from which this certificate was constructed
ba8a548ff252 Expand certificate class to make raw data accessible
Andre Heinecke <aheinecke@intevation.de>
parents: 82
diff changeset
82 *
ba8a548ff252 Expand certificate class to make raw data accessible
Andre Heinecke <aheinecke@intevation.de>
parents: 82
diff changeset
83 * The resulting line includes the instruction e.g.
ba8a548ff252 Expand certificate class to make raw data accessible
Andre Heinecke <aheinecke@intevation.de>
parents: 82
diff changeset
84 *
ba8a548ff252 Expand certificate class to make raw data accessible
Andre Heinecke <aheinecke@intevation.de>
parents: 82
diff changeset
85 * I:BASE64ENCODEDATA...
ba8a548ff252 Expand certificate class to make raw data accessible
Andre Heinecke <aheinecke@intevation.de>
parents: 82
diff changeset
86 *
ba8a548ff252 Expand certificate class to make raw data accessible
Andre Heinecke <aheinecke@intevation.de>
parents: 82
diff changeset
87 **/
ba8a548ff252 Expand certificate class to make raw data accessible
Andre Heinecke <aheinecke@intevation.de>
parents: 82
diff changeset
88 const QString& base64Line() const {return mBaseLine;}
21
dc1e1e9e62ce Add certificate class and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
89
248
9f0865dc8b14 Add accessor to check if the certificate should be installed
Andre Heinecke <aheinecke@intevation.de>
parents: 186
diff changeset
90 /** @brief Check if this certificate has the install instruction.
9f0865dc8b14 Add accessor to check if the certificate should be installed
Andre Heinecke <aheinecke@intevation.de>
parents: 186
diff changeset
91 *
9f0865dc8b14 Add accessor to check if the certificate should be installed
Andre Heinecke <aheinecke@intevation.de>
parents: 186
diff changeset
92 * This is shorthand for baseLine.startsWith("I:");
9f0865dc8b14 Add accessor to check if the certificate should be installed
Andre Heinecke <aheinecke@intevation.de>
parents: 186
diff changeset
93 **/
9f0865dc8b14 Add accessor to check if the certificate should be installed
Andre Heinecke <aheinecke@intevation.de>
parents: 186
diff changeset
94 bool isInstallCert() const {return mBaseLine.startsWith("I:");}
9f0865dc8b14 Add accessor to check if the certificate should be installed
Andre Heinecke <aheinecke@intevation.de>
parents: 186
diff changeset
95
352
b0a274f4f9e2 Added setter to certificate to change the install/remove state.
Raimund Renkert <rrenkert@intevation.de>
parents: 341
diff changeset
96 /** @brief Set the install instruction for this certificate.
b0a274f4f9e2 Added setter to certificate to change the install/remove state.
Raimund Renkert <rrenkert@intevation.de>
parents: 341
diff changeset
97 *
b0a274f4f9e2 Added setter to certificate to change the install/remove state.
Raimund Renkert <rrenkert@intevation.de>
parents: 341
diff changeset
98 * Set the base 64 line prefix to "I:" or "R:".
b0a274f4f9e2 Added setter to certificate to change the install/remove state.
Raimund Renkert <rrenkert@intevation.de>
parents: 341
diff changeset
99 **/
b0a274f4f9e2 Added setter to certificate to change the install/remove state.
Raimund Renkert <rrenkert@intevation.de>
parents: 341
diff changeset
100 void setInstallCert(bool install);
b0a274f4f9e2 Added setter to certificate to change the install/remove state.
Raimund Renkert <rrenkert@intevation.de>
parents: 341
diff changeset
101
1255
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1108
diff changeset
102 /** @brief wether or not the certificate is editable.
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1108
diff changeset
103 *
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1108
diff changeset
104 * Editable means that the installation status can be changed.
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1108
diff changeset
105 * E.g. You can not change the state of a removal certificate
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1108
diff changeset
106 * that has been removed.
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1108
diff changeset
107 *
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1108
diff changeset
108 * @returns true if the certificate is editable */
357
d56f952ba817 Added member variable for edit state of a certificate.
Raimund Renkert <rrenkert@intevation.de>
parents: 355
diff changeset
109 bool isEditable() const {return mEditable;}
d56f952ba817 Added member variable for edit state of a certificate.
Raimund Renkert <rrenkert@intevation.de>
parents: 355
diff changeset
110
1255
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1108
diff changeset
111 /** @brief setter for the editable property. */
357
d56f952ba817 Added member variable for edit state of a certificate.
Raimund Renkert <rrenkert@intevation.de>
parents: 355
diff changeset
112 void setEditable(bool edit) {mEditable = edit;}
d56f952ba817 Added member variable for edit state of a certificate.
Raimund Renkert <rrenkert@intevation.de>
parents: 355
diff changeset
113
341
36c68dfb821d Added accessors for certificate details.
Raimund Renkert <rrenkert@intevation.de>
parents: 338
diff changeset
114 /** @brief get the subject OU from the certificate */
36c68dfb821d Added accessors for certificate details.
Raimund Renkert <rrenkert@intevation.de>
parents: 338
diff changeset
115 QString subjectOU() const {return mSubjectOU;}
36c68dfb821d Added accessors for certificate details.
Raimund Renkert <rrenkert@intevation.de>
parents: 338
diff changeset
116
36c68dfb821d Added accessors for certificate details.
Raimund Renkert <rrenkert@intevation.de>
parents: 338
diff changeset
117 /** @brief get the subject CN from the certificate */
36c68dfb821d Added accessors for certificate details.
Raimund Renkert <rrenkert@intevation.de>
parents: 338
diff changeset
118 QString subjectCN() const {return mSubjectCN;}
36c68dfb821d Added accessors for certificate details.
Raimund Renkert <rrenkert@intevation.de>
parents: 338
diff changeset
119
36c68dfb821d Added accessors for certificate details.
Raimund Renkert <rrenkert@intevation.de>
parents: 338
diff changeset
120 /** @brief get the subject O from the certificate */
36c68dfb821d Added accessors for certificate details.
Raimund Renkert <rrenkert@intevation.de>
parents: 338
diff changeset
121 QString subjectO() const {return mSubjectO;}
36c68dfb821d Added accessors for certificate details.
Raimund Renkert <rrenkert@intevation.de>
parents: 338
diff changeset
122
36c68dfb821d Added accessors for certificate details.
Raimund Renkert <rrenkert@intevation.de>
parents: 338
diff changeset
123 /** @brief get the subject SN from the certificate */
36c68dfb821d Added accessors for certificate details.
Raimund Renkert <rrenkert@intevation.de>
parents: 338
diff changeset
124 QString subjectSN() const {return mSubjectSN;}
36c68dfb821d Added accessors for certificate details.
Raimund Renkert <rrenkert@intevation.de>
parents: 338
diff changeset
125
36c68dfb821d Added accessors for certificate details.
Raimund Renkert <rrenkert@intevation.de>
parents: 338
diff changeset
126 /** @brief get the date the certificate was issued */
36c68dfb821d Added accessors for certificate details.
Raimund Renkert <rrenkert@intevation.de>
parents: 338
diff changeset
127 QDateTime validFrom() const {return mValidFrom;}
36c68dfb821d Added accessors for certificate details.
Raimund Renkert <rrenkert@intevation.de>
parents: 338
diff changeset
128
36c68dfb821d Added accessors for certificate details.
Raimund Renkert <rrenkert@intevation.de>
parents: 338
diff changeset
129 /** @brief get the date the certificate expires */
36c68dfb821d Added accessors for certificate details.
Raimund Renkert <rrenkert@intevation.de>
parents: 338
diff changeset
130 QDateTime validTo() const {return mValidTo;}
36c68dfb821d Added accessors for certificate details.
Raimund Renkert <rrenkert@intevation.de>
parents: 338
diff changeset
131
380
1220b741cd51 Add some more fields for a certificate
Andre Heinecke <andre.heinecke@intevation.de>
parents: 378
diff changeset
132 /** @brief get the issuer CN from the certificate */
1220b741cd51 Add some more fields for a certificate
Andre Heinecke <andre.heinecke@intevation.de>
parents: 378
diff changeset
133 QString issuerCN() const {return mIssuerCN;}
1220b741cd51 Add some more fields for a certificate
Andre Heinecke <andre.heinecke@intevation.de>
parents: 378
diff changeset
134
1220b741cd51 Add some more fields for a certificate
Andre Heinecke <andre.heinecke@intevation.de>
parents: 378
diff changeset
135 /** @brief get the issuer Organization from the certificate */
1220b741cd51 Add some more fields for a certificate
Andre Heinecke <andre.heinecke@intevation.de>
parents: 378
diff changeset
136 QString issuerO() const {return mIssuerO;}
1220b741cd51 Add some more fields for a certificate
Andre Heinecke <andre.heinecke@intevation.de>
parents: 378
diff changeset
137
378
31079bd54036 Add fingerprint to certificate
Andre Heinecke <andre.heinecke@intevation.de>
parents: 374
diff changeset
138 /** @brief get sha1 sum of the certificate */
31079bd54036 Add fingerprint to certificate
Andre Heinecke <andre.heinecke@intevation.de>
parents: 374
diff changeset
139 QString fingerprint() const {return mFingerprint;}
31079bd54036 Add fingerprint to certificate
Andre Heinecke <andre.heinecke@intevation.de>
parents: 374
diff changeset
140
349
a49766196a7d Add certificateFromFile method
Andre Heinecke <andre.heinecke@intevation.de>
parents: 341
diff changeset
141 /** @brief construct certificate objects from a file
a49766196a7d Add certificateFromFile method
Andre Heinecke <andre.heinecke@intevation.de>
parents: 341
diff changeset
142 *
a49766196a7d Add certificateFromFile method
Andre Heinecke <andre.heinecke@intevation.de>
parents: 341
diff changeset
143 * Constructs a new Certificate Object from a file containing either
a49766196a7d Add certificateFromFile method
Andre Heinecke <andre.heinecke@intevation.de>
parents: 341
diff changeset
144 * one DER encoded certificate or one or many PEM certificates.
a49766196a7d Add certificateFromFile method
Andre Heinecke <andre.heinecke@intevation.de>
parents: 341
diff changeset
145 * If no certificate could be parsed from that file an empty list is
a49766196a7d Add certificateFromFile method
Andre Heinecke <andre.heinecke@intevation.de>
parents: 341
diff changeset
146 * returned.
a49766196a7d Add certificateFromFile method
Andre Heinecke <andre.heinecke@intevation.de>
parents: 341
diff changeset
147 *
a49766196a7d Add certificateFromFile method
Andre Heinecke <andre.heinecke@intevation.de>
parents: 341
diff changeset
148 * The size restrictions for the certificate list file also apply
a49766196a7d Add certificateFromFile method
Andre Heinecke <andre.heinecke@intevation.de>
parents: 341
diff changeset
149 * for this file.
a49766196a7d Add certificateFromFile method
Andre Heinecke <andre.heinecke@intevation.de>
parents: 341
diff changeset
150 **/
a49766196a7d Add certificateFromFile method
Andre Heinecke <andre.heinecke@intevation.de>
parents: 341
diff changeset
151 static QList<Certificate> fromFileName (const QString& file_name);
a49766196a7d Add certificateFromFile method
Andre Heinecke <andre.heinecke@intevation.de>
parents: 341
diff changeset
152
1255
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1108
diff changeset
153 /** @brief comparator of two certificates.
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1108
diff changeset
154 *
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1108
diff changeset
155 * Two certificates are equal if their base64 raw data is a match
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1108
diff changeset
156 * regardless of other meta information like state or wether or not
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1108
diff changeset
157 * it is editable.
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1108
diff changeset
158 *
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1108
diff changeset
159 * @returns true if the base64 line of two certificates is equal.
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1108
diff changeset
160 **/
386
cc1738b398a0 Add == operator for certificates that compares the b64line
Andre Heinecke <andre.heinecke@intevation.de>
parents: 380
diff changeset
161 friend inline bool operator==(const Certificate& lhs, const Certificate& rhs) {
cc1738b398a0 Add == operator for certificates that compares the b64line
Andre Heinecke <andre.heinecke@intevation.de>
parents: 380
diff changeset
162 return lhs.base64Line() == rhs.base64Line();
cc1738b398a0 Add == operator for certificates that compares the b64line
Andre Heinecke <andre.heinecke@intevation.de>
parents: 380
diff changeset
163 }
1288
265583011f24 (issue123) Add possibility to open native certificate dialog
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1255
diff changeset
164
265583011f24 (issue123) Add possibility to open native certificate dialog
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1255
diff changeset
165 /** @brief Show the certificate in a native ui dialog.
265583011f24 (issue123) Add possibility to open native certificate dialog
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1255
diff changeset
166 *
265583011f24 (issue123) Add possibility to open native certificate dialog
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1255
diff changeset
167 * The dialog is external and handled by the OS on windows
265583011f24 (issue123) Add possibility to open native certificate dialog
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1255
diff changeset
168 * on GNU/Linux gcr-viewer is used.
265583011f24 (issue123) Add possibility to open native certificate dialog
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1255
diff changeset
169 *
265583011f24 (issue123) Add possibility to open native certificate dialog
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1255
diff changeset
170 * If parentWindow is not NULL it is used as a handle to the
265583011f24 (issue123) Add possibility to open native certificate dialog
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1255
diff changeset
171 * parent Window. Unused on GNU/Linux
265583011f24 (issue123) Add possibility to open native certificate dialog
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1255
diff changeset
172 *
265583011f24 (issue123) Add possibility to open native certificate dialog
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1255
diff changeset
173 * @returns true on success. false if no native dialog could be shown.
265583011f24 (issue123) Add possibility to open native certificate dialog
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1255
diff changeset
174 */
265583011f24 (issue123) Add possibility to open native certificate dialog
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1255
diff changeset
175 bool showNativeUI(void *parentWindow);
265583011f24 (issue123) Add possibility to open native certificate dialog
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1255
diff changeset
176
21
dc1e1e9e62ce Add certificate class and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
177 private:
338
64e38886f903 Use certhelp for certificate parsing and add some dummy info
Andre Heinecke <aheinecke@intevation.de>
parents: 265
diff changeset
178 /** @brief Helper function to parse the details of a certificate **/
64e38886f903 Use certhelp for certificate parsing and add some dummy info
Andre Heinecke <aheinecke@intevation.de>
parents: 265
diff changeset
179 void parseDetails(const QByteArray& cert);
64e38886f903 Use certhelp for certificate parsing and add some dummy info
Andre Heinecke <aheinecke@intevation.de>
parents: 265
diff changeset
180
21
dc1e1e9e62ce Add certificate class and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
181 bool mValid;
545
d59745a8a9bf class Certificate: disable unused member variable mInstCert for now. (cppcheck-1.65 warning.)
Bernhard Reiter <bernhard@intevation.de>
parents: 404
diff changeset
182 /* bool mInstCert; */
357
d56f952ba817 Added member variable for edit state of a certificate.
Raimund Renkert <rrenkert@intevation.de>
parents: 355
diff changeset
183 bool mEditable;
83
ba8a548ff252 Expand certificate class to make raw data accessible
Andre Heinecke <aheinecke@intevation.de>
parents: 82
diff changeset
184
338
64e38886f903 Use certhelp for certificate parsing and add some dummy info
Andre Heinecke <aheinecke@intevation.de>
parents: 265
diff changeset
185 QString mSubjectOU,
64e38886f903 Use certhelp for certificate parsing and add some dummy info
Andre Heinecke <aheinecke@intevation.de>
parents: 265
diff changeset
186 mSubjectCN,
64e38886f903 Use certhelp for certificate parsing and add some dummy info
Andre Heinecke <aheinecke@intevation.de>
parents: 265
diff changeset
187 mSubjectO,
64e38886f903 Use certhelp for certificate parsing and add some dummy info
Andre Heinecke <aheinecke@intevation.de>
parents: 265
diff changeset
188 mSubjectSN,
64e38886f903 Use certhelp for certificate parsing and add some dummy info
Andre Heinecke <aheinecke@intevation.de>
parents: 265
diff changeset
189 mDetails,
378
31079bd54036 Add fingerprint to certificate
Andre Heinecke <andre.heinecke@intevation.de>
parents: 374
diff changeset
190 mBaseLine,
380
1220b741cd51 Add some more fields for a certificate
Andre Heinecke <andre.heinecke@intevation.de>
parents: 378
diff changeset
191 mFingerprint,
1220b741cd51 Add some more fields for a certificate
Andre Heinecke <andre.heinecke@intevation.de>
parents: 378
diff changeset
192 mIssuerO,
1220b741cd51 Add some more fields for a certificate
Andre Heinecke <andre.heinecke@intevation.de>
parents: 378
diff changeset
193 mIssuerCN;
338
64e38886f903 Use certhelp for certificate parsing and add some dummy info
Andre Heinecke <aheinecke@intevation.de>
parents: 265
diff changeset
194
64e38886f903 Use certhelp for certificate parsing and add some dummy info
Andre Heinecke <aheinecke@intevation.de>
parents: 265
diff changeset
195 QDateTime mValidFrom,
64e38886f903 Use certhelp for certificate parsing and add some dummy info
Andre Heinecke <aheinecke@intevation.de>
parents: 265
diff changeset
196 mValidTo;
21
dc1e1e9e62ce Add certificate class and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
197 };
dc1e1e9e62ce Add certificate class and use it
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
198 #endif

http://wald.intevation.org/projects/trustbridge/