2
* Author: Copyright (C) Rudolf Boeddeker Date: 2013-08-13
4
* This file is part of Nitrokey 2
6
* Nitrokey 2 is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation, either version 3 of the License, or
11
* Nitrokey is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with Nitrokey. If not, see <http://www.gnu.org/licenses/>.
2
* Author: Copyright (C) Rudolf Boeddeker Date: 2013-08-13
4
* This file is part of Nitrokey 2
6
* Nitrokey 2 is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation, either version 3 of the License, or
11
* Nitrokey is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* You should have received a copy of the GNU General Public License
17
* along with Nitrokey. If not, see <http://www.gnu.org/licenses/>.
20
20
#include "stick20infodialog.h"
21
21
#include "ui_stick20infodialog.h"
23
23
#include "stick20hid.h"
25
Stick20InfoDialog::Stick20InfoDialog(QWidget *parent)
26
: QDialog(parent), ui(new Ui::Stick20InfoDialog) {
28
showStick20Configuration();
31
Stick20InfoDialog::~Stick20InfoDialog() { delete ui; }
26
Stick20InfoDialog::Stick20InfoDialog(QWidget *parent) :
28
ui(new Ui::Stick20InfoDialog)
31
showStick20Configuration ();
34
Stick20InfoDialog::~Stick20InfoDialog()
33
40
/*******************************************************************************
44
51
*******************************************************************************/
46
void Stick20InfoDialog::showStick20Configuration(void) {
49
OutputText.append(QString(tr("Nitrokey Storage status\n\n")));
51
if (TRUE == HID_Stick20Configuration_st.StickKeysNotInitiated) {
52
OutputText.append(QString(" *** Warning: Device is not secure ***")).append("\n");
53
OutputText.append(QString(" *** Select -Init keys- ***"))
58
OutputText.append(QString("Firmware version "));
60
QString("%1").arg(QString::number(HID_Stick20Configuration_st.VersionInfo_au8[0])));
61
OutputText.append(QString("."));
63
QString("%1").arg(QString::number(HID_Stick20Configuration_st.VersionInfo_au8[1])));
64
OutputText.append(QString("\n"));
66
if (TRUE == HID_Stick20Configuration_st.FirmwareLocked_u8) {
67
OutputText.append(QString("*** Firmware is locked *** ")).append("\n");
70
if (READ_WRITE_ACTIVE == HID_Stick20Configuration_st.ReadWriteFlagUncryptedVolume_u8) {
71
OutputText.append(QString("Unencrypted volume READ/WRITE mode ")).append("\n");
73
OutputText.append(QString("Unencrypted volume READ ONLY mode ")).append("\n");
76
if (0 != (HID_Stick20Configuration_st.VolumeActiceFlag_u8 & (1 << SD_CRYPTED_VOLUME_BIT_PLACE))) {
77
OutputText.append(QString("Encrypted volume active")).append("\n");
79
OutputText.append(QString("Encrypted volume not active")).append("\n");
82
if (0 != (HID_Stick20Configuration_st.VolumeActiceFlag_u8 & (1 << SD_HIDDEN_VOLUME_BIT_PLACE))) {
83
OutputText.append(QString("Hidden volume active")).append("\n");
86
OutputText.append(QString("SD change counter "));
89
QString("%1").arg(QString::number(HID_Stick20Configuration_st.NewSDCardFound_u8 >> 1)))
92
OutputText.append(QString("SD erase counter "));
94
.append(QString("%1").arg(
95
QString::number(HID_Stick20Configuration_st.SDFillWithRandomChars_u8 >> 1)))
98
OutputText.append(QString("\n"));
99
OutputText.append(QString("SD card info\n"));
101
OutputText.append(QString(" ID 0x"));
104
QString("%1").arg(QString::number(HID_Stick20Configuration_st.ActiveSD_CardID_u32, 16)))
107
if (0 != (HID_Stick20Configuration_st.NewSDCardFound_u8 & 0x01)) {
108
// OutputText.append(QString(" *** New SD card found ***\n"));
111
if (0 == (HID_Stick20Configuration_st.SDFillWithRandomChars_u8 & 0x01)) {
112
OutputText.append(QString(" *** Storage is not initialized with random data ***\n"));
115
OutputText.append(QString("\n"));
116
OutputText.append(QString("Smartcard info\n"));
118
OutputText.append(QString(" ID 0x"));
121
QString("%1").arg(QString::number(HID_Stick20Configuration_st.ActiveSmartCardID_u32, 16)))
124
OutputText.append(QString(" Password retry counter\n"));
125
OutputText.append(QString(" Admin : "));
127
.append(QString("%1").arg(QString::number(HID_Stick20Configuration_st.AdminPwRetryCount)))
130
OutputText.append(QString(" User : "));
132
.append(QString("%1").arg(QString::number(HID_Stick20Configuration_st.UserPwRetryCount)))
135
ui->Infotext->setText(OutputText);
138
void Stick20InfoDialog::on_pushButton_clicked() { done(true); }
54
void Stick20InfoDialog::showStick20Configuration (void)
58
OutputText.append(QString("Nitrokey Storage status\n\n"));
60
if (TRUE == HID_Stick20Configuration_st.StickKeysNotInitiated)
62
OutputText.append(QString(" *** Warning: Device is not secure ***")).append("\n");
63
OutputText.append(QString(" *** Select -Init keys- ***")).append("\n").append("\n");
66
OutputText.append(QString("Firmware version "));
67
OutputText.append(QString("%1").arg(QString::number(HID_Stick20Configuration_st.VersionInfo_au8[0])));
68
OutputText.append(QString("."));
69
OutputText.append(QString("%1").arg(QString::number(HID_Stick20Configuration_st.VersionInfo_au8[1])));
70
OutputText.append(QString("\n"));
72
if (TRUE == HID_Stick20Configuration_st.FirmwareLocked_u8)
74
OutputText.append(QString("*** Firmware is locked *** ")).append("\n");
77
if (READ_WRITE_ACTIVE == HID_Stick20Configuration_st.ReadWriteFlagUncryptedVolume_u8)
79
OutputText.append(QString("Unencrypted volume READ/WRITE mode ")).append("\n");
83
OutputText.append(QString("Unencrypted volume READ ONLY mode ")).append("\n");
86
if (0 != (HID_Stick20Configuration_st.VolumeActiceFlag_u8 & (1 << SD_CRYPTED_VOLUME_BIT_PLACE)))
88
OutputText.append(QString("Encrypted volume active")).append("\n");
92
OutputText.append(QString("Encrypted volume not active")).append("\n");
95
if (0 != (HID_Stick20Configuration_st.VolumeActiceFlag_u8 & (1 << SD_HIDDEN_VOLUME_BIT_PLACE)))
97
OutputText.append(QString("Hidden volume active")).append("\n");
102
OutputText.append(QString("SD change counter "));
103
OutputText.append(QString("%1").arg(QString::number(HID_Stick20Configuration_st.NewSDCardFound_u8 >> 1))).append("\n");
105
OutputText.append(QString("SD erase counter "));
106
OutputText.append(QString("%1").arg(QString::number(HID_Stick20Configuration_st.SDFillWithRandomChars_u8 >> 1))).append("\n");
109
OutputText.append(QString("\n"));
110
OutputText.append(QString("SD card info\n"));
112
OutputText.append(QString(" ID 0x"));
113
OutputText.append(QString("%1").arg(QString::number(HID_Stick20Configuration_st.ActiveSD_CardID_u32,16))).append("\n");
116
if (0 != (HID_Stick20Configuration_st.NewSDCardFound_u8 & 0x01))
118
// OutputText.append(QString(" *** New SD card found ***\n"));
121
if (0 == (HID_Stick20Configuration_st.SDFillWithRandomChars_u8 & 0x01))
123
OutputText.append(QString(" *** Storage is not initialized with random data ***\n"));
127
OutputText.append(QString("\n"));
128
OutputText.append(QString("Smartcard info\n"));
130
OutputText.append(QString(" ID 0x"));
131
OutputText.append(QString("%1").arg(QString::number(HID_Stick20Configuration_st.ActiveSmartCardID_u32,16))).append("\n");
133
OutputText.append(QString(" Password retry counter\n"));
134
OutputText.append(QString(" Admin : "));
135
OutputText.append(QString("%1").arg(QString::number(HID_Stick20Configuration_st.AdminPwRetryCount))).append("\n");
137
OutputText.append(QString(" User : "));
138
OutputText.append(QString("%1").arg(QString::number(HID_Stick20Configuration_st.UserPwRetryCount))).append("\n");
140
ui->Infotext->setText(OutputText);
144
void Stick20InfoDialog::on_pushButton_clicked()