From f4d67e362695429d89497cd49c0c7f71057bfe82 Mon Sep 17 00:00:00 2001 From: Raul Metsma Date: Mon, 8 Jan 2024 13:32:50 +0200 Subject: [PATCH] Remove Gemalto card support WE2-839 Signed-off-by: Raul Metsma --- lib/libelectronic-id | 2 +- src/app/CMakeLists.txt | 2 +- tests/mock-ui/mock-ui.hpp | 2 +- tests/tests/main.cpp | 51 +++++++++++++++++++++------------------ 4 files changed, 30 insertions(+), 27 deletions(-) diff --git a/lib/libelectronic-id b/lib/libelectronic-id index a222d489..a89a2b17 160000 --- a/lib/libelectronic-id +++ b/lib/libelectronic-id @@ -1 +1 @@ -Subproject commit a222d489680a6cf393fc9ed60a3b5d895156cf7c +Subproject commit a89a2b17e6c666dfbe96f66c3efbed53b0fbdf5d diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt index 73926f5e..82ea6ad6 100644 --- a/src/app/CMakeLists.txt +++ b/src/app/CMakeLists.txt @@ -52,7 +52,7 @@ if(WIN32) COMMAND ${LIGHT_CMD} -o "${BASE_FILE}.qt.msi" WORKING_DIRECTORY $ ) - add_custom_target(bundle + add_custom_target(bundle DEPENDS installer COMMAND "$ENV{WIX}bin\\candle.exe" -nologo -ext WixBalExtension -ext WixUtilExtension -dwebeid="${BASE_FILE}" -dMSI_VERSION=${PROJECT_VERSION} -dpath="${CMAKE_SOURCE_DIR}/install" "${CMAKE_SOURCE_DIR}/install/plugins.wxs" COMMAND "$ENV{WIX}bin\\light.exe" "plugins.wixobj" -nologo -ext WixBalExtension -out "${BASE_FILE}.exe" diff --git a/tests/mock-ui/mock-ui.hpp b/tests/mock-ui/mock-ui.hpp index a4078c01..edc0796d 100644 --- a/tests/mock-ui/mock-ui.hpp +++ b/tests/mock-ui/mock-ui.hpp @@ -35,7 +35,7 @@ class MockUI : public WebEidUI QString getPin() override { - static QString pin {"0090"}; + static QString pin {"1234"}; return pin; } diff --git a/tests/tests/main.cpp b/tests/tests/main.cpp index 281d6a51..89f19e2f 100644 --- a/tests/tests/main.cpp +++ b/tests/tests/main.cpp @@ -31,6 +31,7 @@ #include "mock-ui.hpp" #include "getcommandhandler-mock.hpp" +#define NO_SIGNATURE #include "select-certificate-script.hpp" #include "atrs.hpp" #include "changecertificatevaliduntil.hpp" @@ -123,22 +124,22 @@ void WebEidTests::getCertificate_validCertificateHasExpectedCertificateSubject() // assert const auto certInfo = getCertAndPinInfoFromSignalSpy(certificateReadySpy); - QCOMPARE(certInfo.subject, QStringLiteral("M\u00C4NNIK, MARI-LIIS, 61709210125")); + QCOMPARE(certInfo.subject, QStringLiteral("J\u00D5EORG, JAAK-KRISTJAN, 38001085718")); - const auto certBytes = - QByteArray::fromBase64(controller->result()["certificate"].toString().toUtf8()); + const auto certBytes = QByteArray::fromBase64( + controller->result()[QStringLiteral("certificate")].toString().toUtf8()); const auto cert = QSslCertificate(certBytes, QSsl::EncodingFormat::Der); QVERIFY(!cert.isNull()); - QCOMPARE(cert.subjectInfo(QSslCertificate::CommonName)[0], - QStringLiteral("M\u00C4NNIK,MARI-LIIS,61709210125")); + QCOMPARE(cert.subjectInfo(QSslCertificate::CommonName).constFirst(), + QStringLiteral("J\u00D5EORG,JAAK-KRISTJAN,38001085718")); } void WebEidTests::getCertificate_expiredCertificateHasExpectedCertificateSubject() { // arrange - PcscMock::setAtr(ESTEID_GEMALTO_V3_5_8_COLD_ATR); + PcscMock::setAtr(ESTEID_IDEMIA_V1_ATR); PcscMock::setApduScript( - replaceCertValidUntilTo2010(ESTEID_GEMALTO_V3_5_8_GET_SIGN_CERTIFICATE_AND_SIGNING)); + replaceCertValidUntilTo2010(ESTEID_IDEMIA_V1_SELECT_SIGN_CERTIFICATE_AND_SIGNING)); initGetCert(); @@ -150,14 +151,14 @@ void WebEidTests::getCertificate_expiredCertificateHasExpectedCertificateSubject // assert const auto certInfo = getCertAndPinInfoFromSignalSpy(certificateReadySpy); - QCOMPARE(certInfo.subject, QStringLiteral("M\u00C4NNIK, MARI-LIIS, 61709210125")); + QCOMPARE(certInfo.subject, QStringLiteral("J\u00D5EORG, JAAK-KRISTJAN, 38001085718")); - const auto certBytes = - QByteArray::fromBase64(controller->result()["certificate"].toString().toUtf8()); + const auto certBytes = QByteArray::fromBase64( + controller->result()[QStringLiteral("certificate")].toString().toUtf8()); const auto cert = QSslCertificate(certBytes, QSsl::EncodingFormat::Der); QVERIFY(!cert.isNull()); - QCOMPARE(cert.subjectInfo(QSslCertificate::CommonName)[0], - QStringLiteral("M\u00C4NNIK,MARI-LIIS,61709210125")); + QCOMPARE(cert.subjectInfo(QSslCertificate::CommonName).constFirst(), + QStringLiteral("J\u00D5EORG,JAAK-KRISTJAN,38001085718")); } void WebEidTests::getCertificate_outputsSupportedAlgos() @@ -175,7 +176,9 @@ void WebEidTests::getCertificate_outputsSupportedAlgos() runEventLoopVerifySignalsEmitted(certificateReadySpy); // assert - QCOMPARE(controller->result()["supportedSignatureAlgorithms"].toList()[0].toMap(), ES224_ALGO); + QCOMPARE( + controller->result()[QStringLiteral("supportedSignatureAlgorithms")].toList()[0].toMap(), + ES224_ALGO); } void WebEidTests::authenticate_validArgumentsResultInValidToken() @@ -192,15 +195,15 @@ void WebEidTests::authenticate_validArgumentsResultInValidToken() // assert const auto certInfo = getCertAndPinInfoFromSignalSpy(authenticateSpy); - QCOMPARE(certInfo.subject, QStringLiteral("M\u00C4NNIK, MARI-LIIS, 61709210125")); + QCOMPARE(certInfo.subject, QStringLiteral("J\u00D5EORG, JAAK-KRISTJAN, 38001085718")); - QCOMPARE(controller->result()["unverifiedCertificate"].toString().left(25), - QStringLiteral("MIIGRzCCBC+gAwIBAgIQRA7X0")); + QCOMPARE(controller->result()[QStringLiteral("unverifiedCertificate")].toString().left(25), + QStringLiteral("MIIEAzCCA2WgAwIBAgIQOWkBW")); } void WebEidTests::fromPunycode_decodesEeDomain() { - QCOMPARE(fromPunycode(QUrl("https://xn--igusnunik-p7af.ee")), + QCOMPARE(fromPunycode(QUrl(QStringLiteral("https://xn--igusnunik-p7af.ee"))), QStringLiteral("\u00F5igusn\u00F5unik.ee")); } @@ -216,7 +219,7 @@ void WebEidTests::quit_exits() } catch (const std::exception& e) { QFAIL(QStringLiteral("WebEidTests::quit_exits() failed with exception: %s") - .arg(e.what()) + .arg(QLatin1String(e.what())) .toUtf8()); } } @@ -248,7 +251,7 @@ void WebEidTests::initGetCert() } catch (const std::exception& e) { QFAIL(QStringLiteral("WebEidTests::initGetCert() failed with exception: %s") - .arg(e.what()) + .arg(QLatin1String(e.what())) .toUtf8()); } } @@ -264,7 +267,7 @@ void WebEidTests::initAuthenticate() } catch (const std::exception& e) { QFAIL(QStringLiteral("WebEidTests::initAuthenticate() failed with exception: %s") - .arg(e.what()) + .arg(QLatin1String(e.what())) .toUtf8()); } } @@ -272,15 +275,15 @@ void WebEidTests::initAuthenticate() void WebEidTests::initCard(bool withSigningScript) { try { - PcscMock::setAtr(ESTEID_GEMALTO_V3_5_8_COLD_ATR); + PcscMock::setAtr(ESTEID_IDEMIA_V1_ATR); const auto notExpiredCertScript = replaceCertValidUntilToNextYear( - withSigningScript ? ESTEID_GEMALTO_V3_5_8_GET_SIGN_CERTIFICATE_AND_SIGNING - : ESTEID_GEMALTO_V3_5_8_GET_AUTH_CERTIFICATE_AND_AUTHENTICATE); + withSigningScript ? ESTEID_IDEMIA_V1_SELECT_SIGN_CERTIFICATE_AND_SIGNING + : ESTEID_IDEMIA_V1_SELECT_AUTH_CERTIFICATE_AND_AUTHENTICATE); PcscMock::setApduScript(notExpiredCertScript); } catch (const std::exception& e) { QFAIL(QStringLiteral("WebEidTests::initCard() failed with exception: %s") - .arg(e.what()) + .arg(QLatin1String(e.what())) .toUtf8()); } }