Skip to content

Commit 7e98904

Browse files
committed
Show warning when card requires activation
WE2-1114 Signed-off-by: Raul Metsma <[email protected]>
1 parent 7defef0 commit 7e98904

File tree

19 files changed

+161
-40
lines changed

19 files changed

+161
-40
lines changed

.github/workflows/cmake-macos.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818

1919
steps:
2020
- name: Checkout code
21-
uses: actions/checkout@v4
21+
uses: actions/checkout@v5
2222
with:
2323
submodules: recursive
2424

@@ -64,7 +64,7 @@ jobs:
6464
- name: Install Qt
6565
uses: jurplel/install-qt-action@v4
6666
with:
67-
version: 6.9.1
67+
version: 6.9.3
6868
arch: clang_64
6969

7070
- name: Configure

.github/workflows/cmake-windows.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,14 @@ env:
99

1010
jobs:
1111
build:
12-
runs-on: windows-2022
12+
runs-on: windows-2025
1313
strategy:
1414
matrix:
1515
arch: [x64, arm64]
1616

1717
steps:
1818
- name: Checkout code
19-
uses: actions/checkout@v4
19+
uses: actions/checkout@v5
2020
with:
2121
submodules: recursive
2222

@@ -30,7 +30,7 @@ jobs:
3030
- name: Install Qt
3131
uses: jurplel/install-qt-action@v4
3232
with:
33-
version: 6.9.1
33+
version: 6.9.3
3434
arch: ${{ matrix.arch == 'arm64' && 'win64_msvc2022_arm64_cross_compiled' || 'win64_msvc2022_64' }}
3535

3636
- name: Setup MS Visual C++ dev env
@@ -40,10 +40,10 @@ jobs:
4040

4141
- name: Install WiX
4242
run: |
43-
dotnet tool install --global wix --version 6.0.1
44-
wix extension -g add WixToolset.UI.wixext/6.0.1
45-
wix extension -g add WixToolset.Util.wixext/6.0.1
46-
wix extension -g add WixToolset.BootstrapperApplications.wixext/6.0.1
43+
dotnet tool install --global wix --version 6.0.2
44+
wix extension -g add WixToolset.UI.wixext/6.0.2
45+
wix extension -g add WixToolset.Util.wixext/6.0.2
46+
wix extension -g add WixToolset.BootstrapperApplications.wixext/6.0.2
4747
4848
- name: Configure
4949
run: |

install/vcpkg.json

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"name": "web-eid-app",
3+
"dependencies": ["openssl", "gtest"],
4+
"builtin-baseline": "bc38a15b0bee8bc48a49ea267cc32fbb49aedfc4"
5+
}

src/controller/certandpininfo.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ struct PinInfo
4040
using PinMinMaxLength = std::pair<uint8_t, uint8_t>;
4141
using PinRetriesCount = std::pair<int8_t, int8_t>;
4242

43-
PinMinMaxLength pinMinMaxLength = {0, 0};
44-
PinRetriesCount pinRetriesCount = {0, -1};
43+
PinMinMaxLength pinMinMaxLength {0, 0};
44+
PinRetriesCount pinRetriesCount {0, -1};
4545
bool readerHasPinPad = false;
46-
bool pinIsBlocked = false;
46+
constexpr bool pinIsBlocked() const { return pinRetriesCount.first == 0; }
4747

4848
static constexpr int PIN_PAD_PIN_ENTRY_TIMEOUT = pcsc_cpp::PIN_PAD_PIN_ENTRY_TIMEOUT;
4949
};
@@ -55,6 +55,7 @@ struct EidCertificateAndPinInfo
5555
QSslCertificate certificate {};
5656
CertificateInfo certInfo;
5757
PinInfo pinInfo;
58+
bool cardActive = true;
5859
};
5960

6061
Q_DECLARE_METATYPE(EidCertificateAndPinInfo)

src/controller/command-handlers/certificatereader.cpp

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ EidCertificateAndPinInfo getCertificateWithStatusAndInfo(const ElectronicID::ptr
5050
auto serialNumber = certificate.subjectInfo(QSslCertificate::SerialNumber).join(' ');
5151

5252
// http://www.etsi.org/deliver/etsi_en/319400_319499/31941201/01.01.01_60/en_31941201v010101p.pdf
53-
if (serialNumber.size() > 6 && serialNumber.startsWith(QStringLiteral("PNO"))
53+
if (serialNumber.size() > 6 && serialNumber.startsWith(QLatin1String("PNO"))
5454
&& serialNumber[5] == '-')
5555
serialNumber.remove(0, 6);
5656

@@ -61,16 +61,29 @@ EidCertificateAndPinInfo getCertificateWithStatusAndInfo(const ElectronicID::ptr
6161
CertificateInfo certInfo {
6262
certificateType, certificate.expiryDate() < QDateTime::currentDateTimeUtc(),
6363
certificate.effectiveDate() > QDateTime::currentDateTimeUtc(), std::move(subject)};
64-
PinInfo pinInfo {certificateType.isAuthentication() ? eid->authPinMinMaxLength()
65-
: eid->signingPinMinMaxLength(),
66-
certificateType.isAuthentication() ? eid->authPinRetriesLeft()
67-
: eid->signingPinRetriesLeft(),
68-
eid->smartcard().readerHasPinPad()};
69-
if (pinInfo.pinRetriesCount.first == 0) {
70-
pinInfo.pinIsBlocked = true;
64+
auto info = certificateType.isAuthentication() ? eid->authPinInfo() : eid->signingPinInfo();
65+
PinInfo pinInfo {.pinMinMaxLength = certificateType.isAuthentication()
66+
? eid->authPinMinMaxLength()
67+
: eid->signingPinMinMaxLength(),
68+
.pinRetriesCount {
69+
info.retryCount,
70+
info.maxRetry,
71+
},
72+
.readerHasPinPad = eid->smartcard().readerHasPinPad()};
73+
bool cardActive = info.pinActive;
74+
if (certificateType == CertificateType::AUTHENTICATION && eid->type() == ElectronicID::EstEID
75+
&& eid->name() == "EstEIDThales") {
76+
cardActive = eid->signingPinInfo().pinActive;
7177
}
7278

73-
return {eid, std::move(certificateDer), certificate, std::move(certInfo), std::move(pinInfo)};
79+
return {
80+
.eid = eid,
81+
.certificateBytesInDer = std::move(certificateDer),
82+
.certificate = certificate,
83+
.certInfo = std::move(certInfo),
84+
.pinInfo = std::move(pinInfo),
85+
.cardActive = cardActive,
86+
};
7487
}
7588

7689
} // namespace

src/ui/certificatewidget.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -112,11 +112,9 @@ void CertificateWidgetInfo::setCertificateInfo(const EidCertificateAndPinInfo& c
112112
info->setText(CertificateWidget::tr("<b>%1</b><br />Issuer: %2<br />Valid: %3 to %4%5")
113113
.arg(subject, issuer, effectiveDate, expiryDate, warning));
114114
info->parentWidget()->setDisabled(certInfo.notEffective || certInfo.isExpired
115-
|| cardCertPinInfo.pinInfo.pinIsBlocked);
116-
if (warning.isEmpty() && cardCertPinInfo.pinInfo.pinIsBlocked) {
117-
warnIcon->show();
118-
warn->show();
119-
}
115+
|| cardCertPinInfo.pinInfo.pinIsBlocked());
116+
warnIcon->setVisible(warning.isEmpty() && cardCertPinInfo.pinInfo.pinIsBlocked());
117+
warn->setVisible(warning.isEmpty() && cardCertPinInfo.pinInfo.pinIsBlocked());
120118
}
121119

122120
void CertificateWidgetInfo::languageChange()

src/ui/dialog.ui

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -211,6 +211,28 @@ height: 24px;
211211
<property name="bottomMargin">
212212
<number>20</number>
213213
</property>
214+
<item>
215+
<widget class="QLabel" name="lockedWarning">
216+
<property name="styleSheet">
217+
<string notr="true">background-color: #FAE7C9;
218+
color: #003168;
219+
font-family: Roboto, Helvetica;
220+
font-size: 14px;
221+
padding: 10px;
222+
border: none;
223+
border-radius: 4px;</string>
224+
</property>
225+
<property name="text">
226+
<string>Signing with an ID-card isn't possible yet. PIN2 code must be changed in DigiDoc4 application in order to sign. &lt;a href=&quot;https://www.id.ee/en/article/changing-id-card-pin-codes-and-puk-code/&quot;&gt;Additional information&lt;/a&gt;</string>
227+
</property>
228+
<property name="wordWrap">
229+
<bool>true</bool>
230+
</property>
231+
<property name="openExternalLinks">
232+
<bool>true</bool>
233+
</property>
234+
</widget>
235+
</item>
214236
<item>
215237
<widget class="QStackedWidget" name="pageStack">
216238
<property name="currentIndex">

src/ui/translations/cs.ts

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,10 @@
157157
<source>Operation failed</source>
158158
<translation>Operace se nezdařila</translation>
159159
</message>
160+
<message>
161+
<source>PIN entry disabled</source>
162+
<translation type="unfinished"></translation>
163+
</message>
160164
<message>
161165
<source>Card driver error. Please try again.</source>
162166
<translation>Chyba ovladače karty. Zkuste to prosím znovu.</translation>
@@ -193,6 +197,10 @@
193197
<source>Try again</source>
194198
<translation>Zkuste to znovu</translation>
195199
</message>
200+
<message>
201+
<source>Signing with an ID-card isn&apos;t possible yet. PIN2 code must be changed in DigiDoc4 application in order to sign. &lt;a href=&quot;https://www.id.ee/en/article/changing-id-card-pin-codes-and-puk-code/&quot;&gt;Additional information&lt;/a&gt;</source>
202+
<translation type="unfinished"></translation>
203+
</message>
196204
<message>
197205
<source>Cancel</source>
198206
<translation>Zrušit</translation>

src/ui/translations/de.ts

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,13 +155,17 @@
155155
<source>Operation failed</source>
156156
<translation>Der Vorgang ist fehlgeschlagen</translation>
157157
</message>
158+
<message>
159+
<source>PIN entry disabled</source>
160+
<translation type="unfinished"></translation>
161+
</message>
158162
<message>
159163
<source>Card driver error. Please try again.</source>
160164
<translation>Kartentreiberfehler. Bitte versuche es erneut.</translation>
161165
</message>
162166
<message>
163167
<source>Card driver error</source>
164-
<translation>Kartentreiberfehler.</translation>
168+
<translation>Kartentreiberfehler</translation>
165169
</message>
166170
<message>
167171
<source>An error occurred in the Smart Card service required to use the ID-card. Make sure that the ID-card and the card reader are connected correctly or relaunch the Smart Card service.</source>
@@ -191,6 +195,10 @@
191195
<source>Try again</source>
192196
<translation>Versuch es noch einmal</translation>
193197
</message>
198+
<message>
199+
<source>Signing with an ID-card isn&apos;t possible yet. PIN2 code must be changed in DigiDoc4 application in order to sign. &lt;a href=&quot;https://www.id.ee/en/article/changing-id-card-pin-codes-and-puk-code/&quot;&gt;Additional information&lt;/a&gt;</source>
200+
<translation type="unfinished"></translation>
201+
</message>
194202
<message>
195203
<source>Cancel</source>
196204
<translation>Abbrechen</translation>

0 commit comments

Comments
 (0)