annotate ui/createcertlistdialog.h @ 1371:23df332b2a4c

(issue179) Read install signature timestamp from config This also changes the way the sigDt is propgated to the MainWindow. It no longer uses the settings but hands it over as a parameter directly.
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 24 Nov 2014 15:48:49 +0100
parents d009da9cfa10
children
rev   line source
404
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 367
diff changeset
1 /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 367
diff changeset
2 * Software engineering by Intevation GmbH
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 367
diff changeset
3 *
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 367
diff changeset
4 * This file is Free Software under the GNU GPL (v>=2)
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 367
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY!
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 367
diff changeset
6 * See LICENSE.txt for details.
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 367
diff changeset
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
466
0d71ce440bcc Factor out list creation to make it more testable
Andre Heinecke <aheinecke@intevation.de>
parents: 465
diff changeset
15 #include "certificate.h"
0d71ce440bcc Factor out list creation to make it more testable
Andre Heinecke <aheinecke@intevation.de>
parents: 465
diff changeset
16
454
efd1bd85112f Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents: 404
diff changeset
17 #include <polarssl/pk.h>
367
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
18 /**
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
19 * @file createinstallerdialog.h
1255
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
20 * @brief The dialog to select the signing certificate and create a certificate list.
367
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
21 */
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
22
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
23 class QListWidget;
454
efd1bd85112f Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents: 404
diff changeset
24 class AdministratorWindow;
367
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
25
1255
2a1aa9df8f11 (issue133) Improve API documentation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1053
diff changeset
26 /** @brief The dialog to select the signing certificate and create a certificate list.*/
367
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
27 class CreateCertListDialog : public QDialog
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
28 {
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
29 Q_OBJECT
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
30 public:
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
31 /** @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
32 * process
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
33 * */
454
efd1bd85112f Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents: 404
diff changeset
34 CreateCertListDialog(AdministratorWindow *parent);
465
88dfe16a0bb9 Implement certificatelist saving
Andre Heinecke <aheinecke@intevation.de>
parents: 454
diff changeset
35 ~CreateCertListDialog();
367
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
36
466
0d71ce440bcc Factor out list creation to make it more testable
Andre Heinecke <aheinecke@intevation.de>
parents: 465
diff changeset
37 /** @brief write a signed certificate list.
0d71ce440bcc Factor out list creation to make it more testable
Andre Heinecke <aheinecke@intevation.de>
parents: 465
diff changeset
38 *
0d71ce440bcc Factor out list creation to make it more testable
Andre Heinecke <aheinecke@intevation.de>
parents: 465
diff changeset
39 * @param [in] certs The certificates to include in the list
0d71ce440bcc Factor out list creation to make it more testable
Andre Heinecke <aheinecke@intevation.de>
parents: 465
diff changeset
40 * @param [in] filePath The path where the list should be written to
0d71ce440bcc Factor out list creation to make it more testable
Andre Heinecke <aheinecke@intevation.de>
parents: 465
diff changeset
41 * @param [in] listDate The date to write in the list
0d71ce440bcc Factor out list creation to make it more testable
Andre Heinecke <aheinecke@intevation.de>
parents: 465
diff changeset
42 * @param [in] pk The private key to sign with.
0d71ce440bcc Factor out list creation to make it more testable
Andre Heinecke <aheinecke@intevation.de>
parents: 465
diff changeset
43 *
0d71ce440bcc Factor out list creation to make it more testable
Andre Heinecke <aheinecke@intevation.de>
parents: 465
diff changeset
44 * @returns true on success false on error.
0d71ce440bcc Factor out list creation to make it more testable
Andre Heinecke <aheinecke@intevation.de>
parents: 465
diff changeset
45 */
0d71ce440bcc Factor out list creation to make it more testable
Andre Heinecke <aheinecke@intevation.de>
parents: 465
diff changeset
46 static bool writeList(const QList<Certificate>& certs,
0d71ce440bcc Factor out list creation to make it more testable
Andre Heinecke <aheinecke@intevation.de>
parents: 465
diff changeset
47 const QString& filePath, const QDateTime& listDate, pk_context *pk);
0d71ce440bcc Factor out list creation to make it more testable
Andre Heinecke <aheinecke@intevation.de>
parents: 465
diff changeset
48
1317
d009da9cfa10 (issue157) Reload list after successful creation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1255
diff changeset
49 signals:
d009da9cfa10 (issue157) Reload list after successful creation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1255
diff changeset
50 /** @brief signal that is emited when the creation of a new list was successful.*/
d009da9cfa10 (issue157) Reload list after successful creation
Andre Heinecke <andre.heinecke@intevation.de>
parents: 1255
diff changeset
51 void creationSuccessful();
466
0d71ce440bcc Factor out list creation to make it more testable
Andre Heinecke <aheinecke@intevation.de>
parents: 465
diff changeset
52
367
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
53 private:
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
54 void setupGUI();
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
55
465
88dfe16a0bb9 Implement certificatelist saving
Andre Heinecke <aheinecke@intevation.de>
parents: 454
diff changeset
56 QLineEdit *mKeyFile;
88dfe16a0bb9 Implement certificatelist saving
Andre Heinecke <aheinecke@intevation.de>
parents: 454
diff changeset
57 QLineEdit *mSaveDir;
454
efd1bd85112f Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents: 404
diff changeset
58 AdministratorWindow *mAdminWindow;
efd1bd85112f Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents: 404
diff changeset
59
efd1bd85112f Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents: 404
diff changeset
60 pk_context *mPk;
367
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
61
465
88dfe16a0bb9 Implement certificatelist saving
Andre Heinecke <aheinecke@intevation.de>
parents: 454
diff changeset
62 /** @brief show an error message with QMessageBox
88dfe16a0bb9 Implement certificatelist saving
Andre Heinecke <aheinecke@intevation.de>
parents: 454
diff changeset
63 *
88dfe16a0bb9 Implement certificatelist saving
Andre Heinecke <aheinecke@intevation.de>
parents: 454
diff changeset
64 * @param [in] msg The message to show
88dfe16a0bb9 Implement certificatelist saving
Andre Heinecke <aheinecke@intevation.de>
parents: 454
diff changeset
65 */
88dfe16a0bb9 Implement certificatelist saving
Andre Heinecke <aheinecke@intevation.de>
parents: 454
diff changeset
66 void showErrorMessage(const QString &msg);
88dfe16a0bb9 Implement certificatelist saving
Andre Heinecke <aheinecke@intevation.de>
parents: 454
diff changeset
67
88dfe16a0bb9 Implement certificatelist saving
Andre Heinecke <aheinecke@intevation.de>
parents: 454
diff changeset
68 /** @brief load a file into mPk
88dfe16a0bb9 Implement certificatelist saving
Andre Heinecke <aheinecke@intevation.de>
parents: 454
diff changeset
69 *
88dfe16a0bb9 Implement certificatelist saving
Andre Heinecke <aheinecke@intevation.de>
parents: 454
diff changeset
70 * If the file is not a valid key or an error
88dfe16a0bb9 Implement certificatelist saving
Andre Heinecke <aheinecke@intevation.de>
parents: 454
diff changeset
71 * occurs mPk will be NULL after a call to this function.
88dfe16a0bb9 Implement certificatelist saving
Andre Heinecke <aheinecke@intevation.de>
parents: 454
diff changeset
72 *
1053
78798d3af8f0 Fixed doxygen build warnings.
Emanuel Schuetze <emanuel@intevation.de>
parents: 466
diff changeset
73 * @param [in] fileName the file to load
465
88dfe16a0bb9 Implement certificatelist saving
Andre Heinecke <aheinecke@intevation.de>
parents: 454
diff changeset
74 */
88dfe16a0bb9 Implement certificatelist saving
Andre Heinecke <aheinecke@intevation.de>
parents: 454
diff changeset
75 void loadKeyFile(const QString& fileName);
88dfe16a0bb9 Implement certificatelist saving
Andre Heinecke <aheinecke@intevation.de>
parents: 454
diff changeset
76
367
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
77 private slots:
454
efd1bd85112f Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents: 404
diff changeset
78 /** @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
79 *
efd1bd85112f Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents: 404
diff changeset
80 * 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
81 * 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
82 */
367
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
83 void openCertificateSelect();
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
84 void openSaveLocation();
454
efd1bd85112f Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents: 404
diff changeset
85 /** @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
86 *
465
88dfe16a0bb9 Implement certificatelist saving
Andre Heinecke <aheinecke@intevation.de>
parents: 454
diff changeset
87 * The contents of the certificate list are the certificates
88dfe16a0bb9 Implement certificatelist saving
Andre Heinecke <aheinecke@intevation.de>
parents: 454
diff changeset
88 * 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
89 * 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
90 * informed with showErrorMessage */
367
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
91 void createList();
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
92 };
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
93
9491782a8f5a Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff changeset
94 #endif // CREATECERTLISTDIALOG_H

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