Skip to content

Commit bd92c2b

Browse files
authored
Add new LatEID&FinEID cards support (#1359)
IB-8646, IB-8645, IB-8665 Signed-off-by: Raul Metsma <[email protected]>
1 parent 62f084e commit bd92c2b

File tree

3 files changed

+18
-23
lines changed

3 files changed

+18
-23
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ jobs:
112112
container: fedora:${{ matrix.container }}
113113
strategy:
114114
matrix:
115-
container: [41, 42, 43]
115+
container: [42, 43]
116116
steps:
117117
- name: Download artifact
118118
uses: dawidd6/action-download-artifact@v11

client/QPKCS11.cpp

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
#include <QtCore/QDebug>
3030

3131
#include <array>
32+
#include <thread>
3233

3334
template<class Container>
3435
static QString toQString(const Container &c)
@@ -74,11 +75,6 @@ std::vector<CK_OBJECT_HANDLE> QPKCS11::Private::findObject(CK_SESSION_HANDLE ses
7475
return result;
7576
}
7677

77-
void QPKCS11::Private::run()
78-
{
79-
result = f->C_Login(session, CKU_USER, nullptr, 0);
80-
}
81-
8278

8379

8480
QPKCS11::QPKCS11( QObject *parent )
@@ -225,11 +221,12 @@ QPKCS11::PinStatus QPKCS11::login(const TokenData &t)
225221
if(token.flags & CKF_PROTECTED_AUTHENTICATION_PATH)
226222
{
227223
PinPopup p(isSign ? PinPopup::Pin2PinpadType : PinPopup::Pin1PinpadType, cert, f, Application::mainWindow());
228-
connect(d, &Private::started, &p, &PinPopup::startTimer);
229-
connect(d, &Private::finished, &p, &PinPopup::accept);
230-
d->start();
224+
std::thread([&err, &p, this] {
225+
emit p.startTimer();
226+
err = d->f->C_Login(d->session, CKU_USER, nullptr, 0);
227+
p.accept();
228+
}).detach();
231229
p.exec();
232-
err = d->result;
233230
}
234231
else
235232
{
@@ -241,15 +238,15 @@ QPKCS11::PinStatus QPKCS11::login(const TokenData &t)
241238
err = d->f->C_Login(d->session, CKU_USER, CK_UTF8CHAR_PTR(pin.constData()), CK_ULONG(pin.size()));
242239
}
243240

244-
d->f->C_GetTokenInfo(currentSlot, &token);
245-
246241
switch( err )
247242
{
248243
case CKR_OK:
249244
case CKR_USER_ALREADY_LOGGED_IN: return PinOK;
250245
case CKR_CANCEL:
251246
case CKR_FUNCTION_CANCELED: return PinCanceled;
252-
case CKR_PIN_INCORRECT: return (token.flags & CKF_USER_PIN_LOCKED) ? PinLocked : PinIncorrect;
247+
case CKR_PIN_INCORRECT:
248+
d->f->C_GetTokenInfo(currentSlot, &token);
249+
return (token.flags & CKF_USER_PIN_LOCKED) ? PinLocked : PinIncorrect;
253250
case CKR_PIN_LOCKED: return PinLocked;
254251
case CKR_DEVICE_ERROR: return DeviceError;
255252
case CKR_GENERAL_ERROR: return GeneralError;
@@ -332,14 +329,15 @@ bool QPKCS11::reload()
332329
#ifdef Q_OS_MAC
333330
{ QApplication::applicationDirPath() + "/opensc-pkcs11.so", {} },
334331
{ "/Library/latvia-eid/lib/eidlv-pkcs11.bundle/Contents/MacOS/eidlv-pkcs11", "3BDB960080B1FE451F830012428F536549440F900020" }, // LV-G2
332+
{ "/Library/latvia-eid/lib/eidlv-pkcs11.bundle/Contents/MacOS/eidlv-pkcs11", "3BDC960080B1FE451F830012428F54654944320F900012" }, // LV-G2.1
335333
{ "/Library/mCard/lib/mcard-pkcs11.so", "3B9D188131FC358031C0694D54434F5373020505D3" }, // LT-G3
336334
{ "/Library/mCard/lib/mcard-pkcs11.so", "3B9D188131FC358031C0694D54434F5373020604D1" }, // LT-G3.1
337-
{ "/Library/Atostek ID/Atostek-ID-PKCS11.dylib", "3B7F9600008031B865B0850300EF1200F6829000" }, // FI-G3
338335
{ "/Library/Atostek ID/Atostek-ID-PKCS11.dylib", "3B7F9600008031B865B08504021B1200F6829000" }, // FI-G3.1
339336
{ "/Library/Atostek ID/Atostek-ID-PKCS11.dylib", "3B7F9600008031B865B085050011122460829000" }, // FI-G4
340-
{ "/Library/mPolluxDigiSign/libcryptoki.dylib", "3B7F9600008031B865B0850300EF1200F6829000" }, // FI-G3
337+
{ "/Library/Atostek ID/Atostek-ID-PKCS11.dylib", "3B7F9600008031B865B085051024122460829000" }, // FI-G4.1
341338
{ "/Library/mPolluxDigiSign/libcryptoki.dylib", "3B7F9600008031B865B08504021B1200F6829000" }, // FI-G3.1
342339
{ "/Library/mPolluxDigiSign/libcryptoki.dylib", "3B7F9600008031B865B085050011122460829000" }, // FI-G4
340+
{ "/Library/mPolluxDigiSign/libcryptoki.dylib", "3B7F9600008031B865B085051024122460829000" }, // FI-G4.1
343341
{ "/Library/Frameworks/eToken.framework/Versions/Current/libeToken.dylib", "3BD5180081313A7D8073C8211030" },
344342
{ "/Library/Frameworks/eToken.framework/Versions/Current/libeToken.dylib", "3BD518008131FE7D8073C82110F4" },
345343
{ "/Library/Frameworks/eToken.framework/Versions/Current/libeToken.dylib", "3BFF9600008131FE4380318065B0846566FB12017882900085" },
@@ -351,19 +349,20 @@ bool QPKCS11::reload()
351349
{ "opensc-pkcs11.so", {} },
352350
#if defined(Q_OS_LINUX)
353351
{ "/opt/latvia-eid/lib/eidlv-pkcs11.so", "3BDB960080B1FE451F830012428F536549440F900020" }, // LV-G2
352+
{ "/opt/latvia-eid/lib/eidlv-pkcs11.so", "3BDC960080B1FE451F830012428F54654944320F900012" }, // LV-G2.1
354353
{ "mcard-pkcs11.so", "3B9D188131FC358031C0694D54434F5373020505D3" }, // LT-G3
355354
{ "mcard-pkcs11.so", "3B9D188131FC358031C0694D54434F5373020604D1" }, // LT-G3.1
356355
#if Q_PROCESSOR_WORDSIZE == 8
357-
{ "/usr/lib/Atostek-ID-PKCS11.so", "3B7F9600008031B865B0850300EF1200F6829000" }, // FI-G3
358356
{ "/usr/lib/Atostek-ID-PKCS11.so", "3B7F9600008031B865B08504021B1200F6829000" }, // FI-G3.1
359357
{ "/usr/lib/Atostek-ID-PKCS11.so", "3B7F9600008031B865B085050011122460829000" }, // FI-G4
360-
{ "/usr/lib64/libcryptoki.so", "3B7F9600008031B865B0850300EF1200F6829000" }, // FI-G3
358+
{ "/usr/lib/Atostek-ID-PKCS11.so", "3B7F9600008031B865B085051024122460829000" }, // FI-G4.1
361359
{ "/usr/lib64/libcryptoki.so", "3B7F9600008031B865B08504021B1200F6829000" }, // FI-G3.1
362360
{ "/usr/lib64/libcryptoki.so", "3B7F9600008031B865B085050011122460829000" }, // FI-G4
361+
{ "/usr/lib64/libcryptoki.so", "3B7F9600008031B865B085051024122460829000" }, // FI-G4.1
363362
#else
364-
{ "libcryptoki.so", "3B7F9600008031B865B0850300EF1200F6829000" }, // FI-G3
365363
{ "libcryptoki.so", "3B7F9600008031B865B08504021B1200F6829000" }, // FI-G3.1
366364
{ "libcryptoki.so", "3B7F9600008031B865B085050011122460829000" }, // FI-G4
365+
{ "libcryptoki.so", "3B7F9600008031B865B085051024122460829000" }, // FI-G4.1
367366
#endif
368367
{ "/usr/lib/libeTPkcs11.so", "3BD5180081313A7D8073C8211030" },
369368
{ "/usr/lib/libeTPkcs11.so", "3BD518008131FE7D8073C82110F4" },

client/QPKCS11_p.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,10 @@
2424
#include "pkcs11.h"
2525

2626
#include <QtCore/QLibrary>
27-
#include <QtCore/QThread>
2827

2928
#include <vector>
3029

31-
class QPKCS11::Private: public QThread
30+
class QPKCS11::Private: public QObject
3231
{
3332
Q_OBJECT
3433
public:
@@ -41,7 +40,4 @@ class QPKCS11::Private: public QThread
4140
CK_SESSION_HANDLE session = 0;
4241
QByteArray id;
4342
bool isPSS = false;
44-
45-
void run() override;
46-
CK_RV result = CKR_OK;
4743
};

0 commit comments

Comments
 (0)