Mercurial > trustbridge
annotate ui/createcertlistdialog.h @ 465:88dfe16a0bb9
Implement certificatelist saving
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Wed, 23 Apr 2014 15:34:53 +0000 |
parents | efd1bd85112f |
children | 0d71ce440bcc |
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 */ | |
367
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
8 #ifndef CREATECERTLISTDIALOG_H |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
9 #define CREATECERTLISTDIALOG_H |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
10 |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
11 #include <QDialog> |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
12 #include <QMainWindow> |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
13 #include <QLineEdit> |
454
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
404
diff
changeset
|
14 |
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
404
diff
changeset
|
15 #include <polarssl/pk.h> |
367
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
16 /** |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
17 * @file createinstallerdialog.h |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
18 * @brief The dialog to show settings and create an installer. |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
19 */ |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
20 |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
21 class QListWidget; |
454
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
404
diff
changeset
|
22 class AdministratorWindow; |
367
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
23 |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
24 class CreateCertListDialog : public QDialog |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
25 { |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
26 Q_OBJECT |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
27 public: |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
28 /** @brief Create a dialog showing settings for the create certificate list |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
29 * process |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
30 * */ |
454
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
404
diff
changeset
|
31 CreateCertListDialog(AdministratorWindow *parent); |
465
88dfe16a0bb9
Implement certificatelist saving
Andre Heinecke <aheinecke@intevation.de>
parents:
454
diff
changeset
|
32 ~CreateCertListDialog(); |
367
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
33 |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
34 private: |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
35 void setupGUI(); |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
36 |
465
88dfe16a0bb9
Implement certificatelist saving
Andre Heinecke <aheinecke@intevation.de>
parents:
454
diff
changeset
|
37 QLineEdit *mKeyFile; |
88dfe16a0bb9
Implement certificatelist saving
Andre Heinecke <aheinecke@intevation.de>
parents:
454
diff
changeset
|
38 QLineEdit *mSaveDir; |
454
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
404
diff
changeset
|
39 AdministratorWindow *mAdminWindow; |
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
404
diff
changeset
|
40 |
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
404
diff
changeset
|
41 pk_context *mPk; |
367
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
42 |
465
88dfe16a0bb9
Implement certificatelist saving
Andre Heinecke <aheinecke@intevation.de>
parents:
454
diff
changeset
|
43 /** @brief show an error message with QMessageBox |
88dfe16a0bb9
Implement certificatelist saving
Andre Heinecke <aheinecke@intevation.de>
parents:
454
diff
changeset
|
44 * |
88dfe16a0bb9
Implement certificatelist saving
Andre Heinecke <aheinecke@intevation.de>
parents:
454
diff
changeset
|
45 * @param [in] msg The message to show |
88dfe16a0bb9
Implement certificatelist saving
Andre Heinecke <aheinecke@intevation.de>
parents:
454
diff
changeset
|
46 */ |
88dfe16a0bb9
Implement certificatelist saving
Andre Heinecke <aheinecke@intevation.de>
parents:
454
diff
changeset
|
47 void showErrorMessage(const QString &msg); |
88dfe16a0bb9
Implement certificatelist saving
Andre Heinecke <aheinecke@intevation.de>
parents:
454
diff
changeset
|
48 |
88dfe16a0bb9
Implement certificatelist saving
Andre Heinecke <aheinecke@intevation.de>
parents:
454
diff
changeset
|
49 /** @brief load a file into mPk |
88dfe16a0bb9
Implement certificatelist saving
Andre Heinecke <aheinecke@intevation.de>
parents:
454
diff
changeset
|
50 * |
88dfe16a0bb9
Implement certificatelist saving
Andre Heinecke <aheinecke@intevation.de>
parents:
454
diff
changeset
|
51 * If the file is not a valid key or an error |
88dfe16a0bb9
Implement certificatelist saving
Andre Heinecke <aheinecke@intevation.de>
parents:
454
diff
changeset
|
52 * occurs mPk will be NULL after a call to this function. |
88dfe16a0bb9
Implement certificatelist saving
Andre Heinecke <aheinecke@intevation.de>
parents:
454
diff
changeset
|
53 * |
88dfe16a0bb9
Implement certificatelist saving
Andre Heinecke <aheinecke@intevation.de>
parents:
454
diff
changeset
|
54 * @param [in] the file to load |
88dfe16a0bb9
Implement certificatelist saving
Andre Heinecke <aheinecke@intevation.de>
parents:
454
diff
changeset
|
55 */ |
88dfe16a0bb9
Implement certificatelist saving
Andre Heinecke <aheinecke@intevation.de>
parents:
454
diff
changeset
|
56 void loadKeyFile(const QString& fileName); |
88dfe16a0bb9
Implement certificatelist saving
Andre Heinecke <aheinecke@intevation.de>
parents:
454
diff
changeset
|
57 |
367
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
58 private slots: |
454
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
404
diff
changeset
|
59 /** @brief Open the certificate selection dialog and parse the certificate |
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
404
diff
changeset
|
60 * |
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
404
diff
changeset
|
61 * If the certificate can be parsed mPk is replaced by the new key |
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
404
diff
changeset
|
62 * otherwise an error message is shown to the user. |
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
404
diff
changeset
|
63 */ |
367
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
64 void openCertificateSelect(); |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
65 void openSaveLocation(); |
454
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
404
diff
changeset
|
66 /** @brief create a valid certificate list file |
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
404
diff
changeset
|
67 * |
465
88dfe16a0bb9
Implement certificatelist saving
Andre Heinecke <aheinecke@intevation.de>
parents:
454
diff
changeset
|
68 * The contents of the certificate list are the certificates |
88dfe16a0bb9
Implement certificatelist saving
Andre Heinecke <aheinecke@intevation.de>
parents:
454
diff
changeset
|
69 * shown in the adminWindow. It is signed with the currently |
454
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
404
diff
changeset
|
70 * loaded certificate in mPk. On errors the user is |
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
404
diff
changeset
|
71 * informed with showErrorMessage */ |
367
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
72 void createList(); |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
73 }; |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
74 |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
75 #endif // CREATECERTLISTDIALOG_H |