Mercurial > trustbridge
annotate ui/certificatelist.h @ 1272:520d8e6f14a4
(issue44) Fix slot parameters
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Mon, 29 Sep 2014 10:07:52 +0200 |
parents | 2a1aa9df8f11 |
children |
rev | line source |
---|---|
404 | 1 /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik |
2 * Software engineering by Intevation GmbH | |
3 * | |
4 * This file is Free Software under the GNU GPL (v>=2) | |
5 * and comes with ABSOLUTELY NO WARRANTY! | |
6 * See LICENSE.txt for details. | |
7 */ | |
7
992c0ec57660
Add unit tests make CertificateList work.
Andre Heinecke <aheinecke@intevation.de>
parents:
4
diff
changeset
|
8 #ifndef CERTIFICATELIST_H |
992c0ec57660
Add unit tests make CertificateList work.
Andre Heinecke <aheinecke@intevation.de>
parents:
4
diff
changeset
|
9 #define CERTIFICATELIST_H |
1255
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
904
diff
changeset
|
10 |
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
904
diff
changeset
|
11 class QByteArray; |
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
904
diff
changeset
|
12 |
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
904
diff
changeset
|
13 #include <QString> |
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
904
diff
changeset
|
14 #include <QDateTime> |
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
904
diff
changeset
|
15 #include <QObject> |
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
904
diff
changeset
|
16 |
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
904
diff
changeset
|
17 #include "listutil.h" |
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
904
diff
changeset
|
18 #include "certificate.h" |
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
904
diff
changeset
|
19 |
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
904
diff
changeset
|
20 /** @brief Object representation of a certificate list |
2a1aa9df8f11
(issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents:
904
diff
changeset
|
21 * |
4
9849250f50f2
Start implementation of certificatelist parser
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
22 * This class handles a certificate list file. |
9849250f50f2
Start implementation of certificatelist parser
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
23 * It checks for the validity of that certificate |
9849250f50f2
Start implementation of certificatelist parser
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
24 * list file and provides an API for working with that |
9849250f50f2
Start implementation of certificatelist parser
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
25 * file. |
9849250f50f2
Start implementation of certificatelist parser
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
26 * |
9849250f50f2
Start implementation of certificatelist parser
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
27 * The List is parsed on Initialization. You should |
9849250f50f2
Start implementation of certificatelist parser
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
28 * check the Status afterwards to see if the file |
9849250f50f2
Start implementation of certificatelist parser
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
29 * could be parsed. |
9849250f50f2
Start implementation of certificatelist parser
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
30 * |
9849250f50f2
Start implementation of certificatelist parser
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
31 */ |
70
64c8c6350e60
Add default constructor to certificatelist. Remove Q_OBJECT use
Andre Heinecke <aheinecke@intevation.de>
parents:
26
diff
changeset
|
32 class CertificateList |
4
9849250f50f2
Start implementation of certificatelist parser
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
33 { |
9849250f50f2
Start implementation of certificatelist parser
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
34 public: |
70
64c8c6350e60
Add default constructor to certificatelist. Remove Q_OBJECT use
Andre Heinecke <aheinecke@intevation.de>
parents:
26
diff
changeset
|
35 CertificateList(); |
7
992c0ec57660
Add unit tests make CertificateList work.
Andre Heinecke <aheinecke@intevation.de>
parents:
4
diff
changeset
|
36 CertificateList(const char *fileName); |
4
9849250f50f2
Start implementation of certificatelist parser
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
37 |
7
992c0ec57660
Add unit tests make CertificateList work.
Andre Heinecke <aheinecke@intevation.de>
parents:
4
diff
changeset
|
38 list_status_t getStatus() {return mStatus;} |
25
92108a2120f1
Move certificatelist to common. Add cinst directory
Andre Heinecke <aheinecke@intevation.de>
parents:
21
diff
changeset
|
39 |
70
64c8c6350e60
Add default constructor to certificatelist. Remove Q_OBJECT use
Andre Heinecke <aheinecke@intevation.de>
parents:
26
diff
changeset
|
40 /** @brief Read a list |
64c8c6350e60
Add default constructor to certificatelist. Remove Q_OBJECT use
Andre Heinecke <aheinecke@intevation.de>
parents:
26
diff
changeset
|
41 * |
64c8c6350e60
Add default constructor to certificatelist. Remove Q_OBJECT use
Andre Heinecke <aheinecke@intevation.de>
parents:
26
diff
changeset
|
42 * @param[in] fileName the filename of the list to read |
64c8c6350e60
Add default constructor to certificatelist. Remove Q_OBJECT use
Andre Heinecke <aheinecke@intevation.de>
parents:
26
diff
changeset
|
43 * |
64c8c6350e60
Add default constructor to certificatelist. Remove Q_OBJECT use
Andre Heinecke <aheinecke@intevation.de>
parents:
26
diff
changeset
|
44 * @return status of the read. Vaild on success. |
64c8c6350e60
Add default constructor to certificatelist. Remove Q_OBJECT use
Andre Heinecke <aheinecke@intevation.de>
parents:
26
diff
changeset
|
45 */ |
64c8c6350e60
Add default constructor to certificatelist. Remove Q_OBJECT use
Andre Heinecke <aheinecke@intevation.de>
parents:
26
diff
changeset
|
46 list_status_t readList(const char *fileName); |
64c8c6350e60
Add default constructor to certificatelist. Remove Q_OBJECT use
Andre Heinecke <aheinecke@intevation.de>
parents:
26
diff
changeset
|
47 |
904
f89b41fa7048
Fix whitespace errors
Andre Heinecke <andre.heinecke@intevation.de>
parents:
455
diff
changeset
|
48 /** @brief Returns true if the list is Valid |
25
92108a2120f1
Move certificatelist to common. Add cinst directory
Andre Heinecke <aheinecke@intevation.de>
parents:
21
diff
changeset
|
49 * |
92108a2120f1
Move certificatelist to common. Add cinst directory
Andre Heinecke <aheinecke@intevation.de>
parents:
21
diff
changeset
|
50 * A list is valid only if the signature matched and the |
92108a2120f1
Move certificatelist to common. Add cinst directory
Andre Heinecke <aheinecke@intevation.de>
parents:
21
diff
changeset
|
51 * list could be parsed. |
92108a2120f1
Move certificatelist to common. Add cinst directory
Andre Heinecke <aheinecke@intevation.de>
parents:
21
diff
changeset
|
52 */ |
26
cbd57d767dfa
Move layout around. Restructure CMakeLists
Andre Heinecke <andre.heinecke@intevation.de>
parents:
25
diff
changeset
|
53 bool isValid() const {return mStatus == Valid;} |
25
92108a2120f1
Move certificatelist to common. Add cinst directory
Andre Heinecke <aheinecke@intevation.de>
parents:
21
diff
changeset
|
54 |
249
6a7eb102716d
Remove code duplication by unifying the certificatelist.
Andre Heinecke <aheinecke@intevation.de>
parents:
203
diff
changeset
|
55 /* @brief get a list of certificate objects in this list */ |
6a7eb102716d
Remove code duplication by unifying the certificatelist.
Andre Heinecke <aheinecke@intevation.de>
parents:
203
diff
changeset
|
56 const QList<Certificate>& getCertificates() const; |
4
9849250f50f2
Start implementation of certificatelist parser
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
57 |
84
00a93409e93e
Keep raw data around to later pass it to the installer
Andre Heinecke <aheinecke@intevation.de>
parents:
79
diff
changeset
|
58 /* @brief get the raw certificate list */ |
00a93409e93e
Keep raw data around to later pass it to the installer
Andre Heinecke <aheinecke@intevation.de>
parents:
79
diff
changeset
|
59 const QString& rawData() const {return mData;} |
00a93409e93e
Keep raw data around to later pass it to the installer
Andre Heinecke <aheinecke@intevation.de>
parents:
79
diff
changeset
|
60 |
255
c82dab1824be
Expose the filename in certificatelist
Andre Heinecke <aheinecke@intevation.de>
parents:
254
diff
changeset
|
61 /* @brief get the absolute filename of the certificate */ |
c82dab1824be
Expose the filename in certificatelist
Andre Heinecke <aheinecke@intevation.de>
parents:
254
diff
changeset
|
62 const QString& fileName() const {return mFileName;} |
c82dab1824be
Expose the filename in certificatelist
Andre Heinecke <aheinecke@intevation.de>
parents:
254
diff
changeset
|
63 |
455
4204ae2753d9
Added getter for certificate list date.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
64 /* @brief get the list date. */ |
4204ae2753d9
Added getter for certificate list date.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
65 const QDateTime& date() const {return mDate;} |
4204ae2753d9
Added getter for certificate list date.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
66 |
4
9849250f50f2
Start implementation of certificatelist parser
Andre Heinecke <aheinecke@intevation.de>
parents:
diff
changeset
|
67 private: |
249
6a7eb102716d
Remove code duplication by unifying the certificatelist.
Andre Heinecke <aheinecke@intevation.de>
parents:
203
diff
changeset
|
68 QList<Certificate> mCertificates; |
84
00a93409e93e
Keep raw data around to later pass it to the installer
Andre Heinecke <aheinecke@intevation.de>
parents:
79
diff
changeset
|
69 QString mData; |
249
6a7eb102716d
Remove code duplication by unifying the certificatelist.
Andre Heinecke <aheinecke@intevation.de>
parents:
203
diff
changeset
|
70 QString mFileName; |
7
992c0ec57660
Add unit tests make CertificateList work.
Andre Heinecke <aheinecke@intevation.de>
parents:
4
diff
changeset
|
71 list_status_t mStatus; |
9
2ad9a96518e3
Actually parse all elements in the list
Andre Heinecke <aheinecke@intevation.de>
parents:
7
diff
changeset
|
72 QDateTime mDate; |
7
992c0ec57660
Add unit tests make CertificateList work.
Andre Heinecke <aheinecke@intevation.de>
parents:
4
diff
changeset
|
73 }; |
992c0ec57660
Add unit tests make CertificateList work.
Andre Heinecke <aheinecke@intevation.de>
parents:
4
diff
changeset
|
74 #endif |