Mercurial > trustbridge
annotate ui/createcertlistdialog.cpp @ 463:5200b8e9b2ae
Rename tablemodel certificates and add accessors
author | Andre Heinecke <aheinecke@intevation.de> |
---|---|
date | Wed, 23 Apr 2014 15:33:09 +0000 |
parents | efd1bd85112f |
children | 88dfe16a0bb9 |
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 #include "createcertlistdialog.h" |
454
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
9 #include "sslhelp.h" |
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
10 #include "administratorwindow.h" |
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
11 |
367
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
12 #include <QDebug> |
454
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
13 #include <QMessageBox> |
367
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
14 #include <QDir> |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
15 #include <QPushButton> |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
16 #include <QGroupBox> |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
17 #include <QHBoxLayout> |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
18 #include <QVBoxLayout> |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
19 #include <QLabel> |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
20 #include <QFileDialog> |
413
860affe19416
Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
21 #include <QStandardPaths> |
367
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
22 |
454
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
23 #include <polarssl/pk.h> |
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
24 |
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
25 CreateCertListDialog::CreateCertListDialog(AdministratorWindow *parent) : |
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
26 QDialog(parent), |
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
27 mAdminWindow(parent), |
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
28 mPk(NULL) |
367
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
29 { |
413
860affe19416
Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
30 setWindowTitle(tr("Save certificate list")); |
367
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
31 setupGUI(); |
413
860affe19416
Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
32 resize(500, 200); |
454
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
33 mCertFile->setText(mAdminWindow->settings()->value("LastCert", QString()).toString()); |
367
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
34 } |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
35 |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
36 void CreateCertListDialog::setupGUI() |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
37 { |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
38 /* Top level layout / widgets */ |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
39 QVBoxLayout *topLayout = new QVBoxLayout; |
413
860affe19416
Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
40 QVBoxLayout *headerLayout = new QVBoxLayout; |
860affe19416
Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
41 QHBoxLayout *headerSubLayout = new QHBoxLayout; |
428
d1819cd56dee
Updated dialog layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
426
diff
changeset
|
42 QHBoxLayout *centerLayout = new QHBoxLayout; |
367
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
43 QHBoxLayout *bottomLayout = new QHBoxLayout; |
428
d1819cd56dee
Updated dialog layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
426
diff
changeset
|
44 QVBoxLayout *labelLayout = new QVBoxLayout; |
d1819cd56dee
Updated dialog layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
426
diff
changeset
|
45 QVBoxLayout *fieldLayout = new QVBoxLayout; |
d1819cd56dee
Updated dialog layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
426
diff
changeset
|
46 QVBoxLayout *buttonLayout = new QVBoxLayout; |
367
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
47 |
413
860affe19416
Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
48 QLabel *header = new QLabel("<h3>" + tr("Save certificate list") + "</h3>"); |
860affe19416
Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
49 QLabel *description = new QLabel( |
426
d7cda835abd6
Some wording and Layout in TrustBridge Administration.
Raimund Renkert <rrenkert@intevation.de>
parents:
417
diff
changeset
|
50 tr("Save all managed root certificates in a new, signed certificate list.")); |
413
860affe19416
Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
51 headerSubLayout->insertSpacing(0, 40); |
860affe19416
Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
52 headerSubLayout->addWidget(description); |
860affe19416
Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
53 QFrame *headerSeparator = new QFrame(); |
860affe19416
Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
54 headerSeparator->setFrameShape(QFrame::HLine); |
860affe19416
Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
55 headerSeparator->setFrameShadow(QFrame::Sunken); |
860affe19416
Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
56 headerLayout->addWidget(header); |
860affe19416
Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
57 headerLayout->addLayout(headerSubLayout); |
860affe19416
Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
58 headerLayout->addWidget(headerSeparator); |
428
d1819cd56dee
Updated dialog layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
426
diff
changeset
|
59 headerLayout->insertSpacing(3, 10); |
367
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
60 |
413
860affe19416
Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
61 QLabel *certLabel = new QLabel("Select signature certificate (secret key):"); |
428
d1819cd56dee
Updated dialog layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
426
diff
changeset
|
62 QLabel *saveLabel = new QLabel("Select output folder:"); |
d1819cd56dee
Updated dialog layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
426
diff
changeset
|
63 labelLayout->addWidget(certLabel); |
d1819cd56dee
Updated dialog layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
426
diff
changeset
|
64 labelLayout->addWidget(saveLabel); |
d1819cd56dee
Updated dialog layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
426
diff
changeset
|
65 |
367
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
66 mCertFile = new QLineEdit(); |
428
d1819cd56dee
Updated dialog layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
426
diff
changeset
|
67 mSaveFile = new QLineEdit(); |
d1819cd56dee
Updated dialog layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
426
diff
changeset
|
68 fieldLayout->addWidget(mCertFile); |
d1819cd56dee
Updated dialog layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
426
diff
changeset
|
69 fieldLayout->addWidget(mSaveFile); |
d1819cd56dee
Updated dialog layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
426
diff
changeset
|
70 |
367
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
71 QPushButton *certSelect = new QPushButton("..."); |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
72 certSelect->setFixedWidth(30); |
428
d1819cd56dee
Updated dialog layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
426
diff
changeset
|
73 connect(certSelect, SIGNAL(clicked()), this, SLOT(openCertificateSelect())); |
367
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
74 QPushButton *saveSelect = new QPushButton("..."); |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
75 connect(saveSelect, SIGNAL(clicked()), this, SLOT(openSaveLocation())); |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
76 saveSelect->setFixedWidth(30); |
428
d1819cd56dee
Updated dialog layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
426
diff
changeset
|
77 buttonLayout->addWidget(certSelect); |
d1819cd56dee
Updated dialog layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
426
diff
changeset
|
78 buttonLayout->addWidget(saveSelect); |
413
860affe19416
Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
79 |
426
d7cda835abd6
Some wording and Layout in TrustBridge Administration.
Raimund Renkert <rrenkert@intevation.de>
parents:
417
diff
changeset
|
80 QString footerText = tr("In addition, each certificate list will be saved " |
413
860affe19416
Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
81 "automatically in the archive directory:\n"); |
426
d7cda835abd6
Some wording and Layout in TrustBridge Administration.
Raimund Renkert <rrenkert@intevation.de>
parents:
417
diff
changeset
|
82 footerText.append(QStandardPaths::writableLocation( |
d7cda835abd6
Some wording and Layout in TrustBridge Administration.
Raimund Renkert <rrenkert@intevation.de>
parents:
417
diff
changeset
|
83 QStandardPaths::DataLocation)); |
413
860affe19416
Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
84 QLabel *footer = new QLabel(footerText); |
367
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
85 |
428
d1819cd56dee
Updated dialog layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
426
diff
changeset
|
86 centerLayout->addLayout(labelLayout); |
d1819cd56dee
Updated dialog layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
426
diff
changeset
|
87 centerLayout->addLayout(fieldLayout); |
d1819cd56dee
Updated dialog layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
426
diff
changeset
|
88 centerLayout->addLayout(buttonLayout); |
367
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
89 |
428
d1819cd56dee
Updated dialog layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
426
diff
changeset
|
90 QPushButton *create = new QPushButton(tr("Save list")); |
367
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
91 connect(create, SIGNAL(clicked()), this, SLOT(createList())); |
413
860affe19416
Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
92 QPushButton *cancel = new QPushButton(tr("Cancel")); |
860affe19416
Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
93 connect(cancel, SIGNAL(clicked()), this, SLOT(close())); |
367
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
94 bottomLayout->insertStretch(0, 10); |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
95 bottomLayout->addWidget(create); |
413
860affe19416
Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
96 bottomLayout->addWidget(cancel); |
860affe19416
Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
97 |
860affe19416
Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
98 QFrame *bottomSeparator = new QFrame(); |
860affe19416
Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
99 bottomSeparator->setFrameShape(QFrame::HLine); |
860affe19416
Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
100 bottomSeparator->setFrameShadow(QFrame::Sunken); |
367
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
101 |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
102 topLayout->addLayout(headerLayout); |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
103 topLayout->addLayout(centerLayout); |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
104 topLayout->insertStretch(2, 10); |
413
860affe19416
Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
105 topLayout->addWidget(footer); |
428
d1819cd56dee
Updated dialog layout.
Raimund Renkert <rrenkert@intevation.de>
parents:
426
diff
changeset
|
106 topLayout->insertSpacing(4, 10); |
413
860affe19416
Wording und Layout in TrustBridge create certificate file dialog.
Raimund Renkert <rrenkert@intevation.de>
parents:
404
diff
changeset
|
107 topLayout->addWidget(bottomSeparator); |
367
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
108 topLayout->addLayout(bottomLayout); |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
109 |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
110 setLayout(topLayout); |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
111 |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
112 return; |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
113 } |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
114 |
454
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
115 void CreateCertListDialog::showErrorMessage(const QString &msg) |
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
116 { |
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
117 QMessageBox::warning(this, tr("Error!"), msg); |
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
118 } |
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
119 |
367
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
120 void CreateCertListDialog::openCertificateSelect() |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
121 { |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
122 QString certFile = QFileDialog::getOpenFileName( |
454
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
123 this, tr("Select certificate"), mCertFile->text().isEmpty() ? |
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
124 QDir::homePath() : mCertFile->text(), "*.pem"); |
367
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
125 mCertFile->setText(certFile); |
454
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
126 |
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
127 mAdminWindow->settings()->setValue("LastCert", certFile); |
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
128 |
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
129 if (mPk != NULL) { |
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
130 pk_free(mPk); |
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
131 delete mPk; |
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
132 mPk = NULL; |
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
133 } |
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
134 |
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
135 mPk = new pk_context; |
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
136 pk_init(mPk); |
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
137 int ret = pk_parse_keyfile(mPk, mCertFile->text().toLocal8Bit().constData(), ""); |
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
138 |
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
139 if (ret != 0) { |
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
140 showErrorMessage(tr("Failed to load certificate: %1") |
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
141 .arg(getPolarSSLErrorMsg(ret))); |
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
142 return; |
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
143 } |
367
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
144 } |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
145 |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
146 void CreateCertListDialog::openSaveLocation() |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
147 { |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
148 QString saveFile = QFileDialog::getExistingDirectory( |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
149 this, tr("Select target location"), QDir::homePath()); |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
150 mSaveFile->setText(saveFile); |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
151 } |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
152 |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
153 void CreateCertListDialog::createList() |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
154 { |
454
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
155 //entropy_context mEntropy; |
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
156 //ctr_drbg_context mCtr_drbg; |
efd1bd85112f
Save selected certificate in settings and parse it.
Andre Heinecke <aheinecke@intevation.de>
parents:
428
diff
changeset
|
157 |
367
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
158 qDebug() << "and now create the certificate list using:"; |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
159 qDebug() << "certificate: " << mCertFile->text(); |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
160 qDebug() << "target" << mSaveFile->text(); |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
161 // TODO |
9491782a8f5a
Added dialog to create a signed certificate list file.
Raimund Renkert <rrenkert@intevation.de>
parents:
diff
changeset
|
162 } |