Skip to content

Commit 798da4b

Browse files
committed
Remove Gemalto card support
WE2-839 Signed-off-by: Raul Metsma <raul@metsma.ee>
1 parent 3f09869 commit 798da4b

File tree

4 files changed

+30
-27
lines changed

4 files changed

+30
-27
lines changed

src/app/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ if(WIN32)
5252
COMMAND ${LIGHT_CMD} -o "${BASE_FILE}.qt.msi"
5353
WORKING_DIRECTORY $<TARGET_FILE_DIR:web-eid>
5454
)
55-
add_custom_target(bundle
55+
add_custom_target(bundle DEPENDS installer
5656
COMMAND "$ENV{WIX}bin\\candle.exe" -nologo -ext WixBalExtension -ext WixUtilExtension -dwebeid="${BASE_FILE}"
5757
-dMSI_VERSION=${PROJECT_VERSION} -dpath="${CMAKE_SOURCE_DIR}/install" "${CMAKE_SOURCE_DIR}/install/plugins.wxs"
5858
COMMAND "$ENV{WIX}bin\\light.exe" "plugins.wixobj" -nologo -ext WixBalExtension -out "${BASE_FILE}.exe"

tests/mock-ui/mock-ui.hpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ class MockUI : public WebEidUI
3535

3636
QString getPin() override
3737
{
38-
static QString pin {"0090"};
38+
static QString pin {"1234"};
3939
return pin;
4040
}
4141

tests/tests/main.cpp

+27-24
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
#include "mock-ui.hpp"
3232
#include "getcommandhandler-mock.hpp"
3333

34+
#define NO_SIGNATURE
3435
#include "select-certificate-script.hpp"
3536
#include "atrs.hpp"
3637
#include "changecertificatevaliduntil.hpp"
@@ -123,22 +124,22 @@ void WebEidTests::getCertificate_validCertificateHasExpectedCertificateSubject()
123124

124125
// assert
125126
const auto certInfo = getCertAndPinInfoFromSignalSpy(certificateReadySpy);
126-
QCOMPARE(certInfo.subject, QStringLiteral("M\u00C4NNIK, MARI-LIIS, 61709210125"));
127+
QCOMPARE(certInfo.subject, QStringLiteral("J\u00D5EORG, JAAK-KRISTJAN, 38001085718"));
127128

128-
const auto certBytes =
129-
QByteArray::fromBase64(controller->result()["certificate"].toString().toUtf8());
129+
const auto certBytes = QByteArray::fromBase64(
130+
controller->result()[QStringLiteral("certificate")].toString().toUtf8());
130131
const auto cert = QSslCertificate(certBytes, QSsl::EncodingFormat::Der);
131132
QVERIFY(!cert.isNull());
132-
QCOMPARE(cert.subjectInfo(QSslCertificate::CommonName)[0],
133-
QStringLiteral("M\u00C4NNIK,MARI-LIIS,61709210125"));
133+
QCOMPARE(cert.subjectInfo(QSslCertificate::CommonName).constFirst(),
134+
QStringLiteral("J\u00D5EORG,JAAK-KRISTJAN,38001085718"));
134135
}
135136

136137
void WebEidTests::getCertificate_expiredCertificateHasExpectedCertificateSubject()
137138
{
138139
// arrange
139-
PcscMock::setAtr(ESTEID_GEMALTO_V3_5_8_COLD_ATR);
140+
PcscMock::setAtr(ESTEID_IDEMIA_V1_ATR);
140141
PcscMock::setApduScript(
141-
replaceCertValidUntilTo2010(ESTEID_GEMALTO_V3_5_8_GET_SIGN_CERTIFICATE_AND_SIGNING));
142+
replaceCertValidUntilTo2010(ESTEID_IDEMIA_V1_SELECT_SIGN_CERTIFICATE_AND_SIGNING));
142143

143144
initGetCert();
144145

@@ -150,14 +151,14 @@ void WebEidTests::getCertificate_expiredCertificateHasExpectedCertificateSubject
150151

151152
// assert
152153
const auto certInfo = getCertAndPinInfoFromSignalSpy(certificateReadySpy);
153-
QCOMPARE(certInfo.subject, QStringLiteral("M\u00C4NNIK, MARI-LIIS, 61709210125"));
154+
QCOMPARE(certInfo.subject, QStringLiteral("J\u00D5EORG, JAAK-KRISTJAN, 38001085718"));
154155

155-
const auto certBytes =
156-
QByteArray::fromBase64(controller->result()["certificate"].toString().toUtf8());
156+
const auto certBytes = QByteArray::fromBase64(
157+
controller->result()[QStringLiteral("certificate")].toString().toUtf8());
157158
const auto cert = QSslCertificate(certBytes, QSsl::EncodingFormat::Der);
158159
QVERIFY(!cert.isNull());
159-
QCOMPARE(cert.subjectInfo(QSslCertificate::CommonName)[0],
160-
QStringLiteral("M\u00C4NNIK,MARI-LIIS,61709210125"));
160+
QCOMPARE(cert.subjectInfo(QSslCertificate::CommonName).constFirst(),
161+
QStringLiteral("J\u00D5EORG,JAAK-KRISTJAN,38001085718"));
161162
}
162163

163164
void WebEidTests::getCertificate_outputsSupportedAlgos()
@@ -175,7 +176,9 @@ void WebEidTests::getCertificate_outputsSupportedAlgos()
175176
runEventLoopVerifySignalsEmitted(certificateReadySpy);
176177

177178
// assert
178-
QCOMPARE(controller->result()["supportedSignatureAlgorithms"].toList()[0].toMap(), ES224_ALGO);
179+
QCOMPARE(
180+
controller->result()[QStringLiteral("supportedSignatureAlgorithms")].toList()[0].toMap(),
181+
ES224_ALGO);
179182
}
180183

181184
void WebEidTests::authenticate_validArgumentsResultInValidToken()
@@ -192,15 +195,15 @@ void WebEidTests::authenticate_validArgumentsResultInValidToken()
192195

193196
// assert
194197
const auto certInfo = getCertAndPinInfoFromSignalSpy(authenticateSpy);
195-
QCOMPARE(certInfo.subject, QStringLiteral("M\u00C4NNIK, MARI-LIIS, 61709210125"));
198+
QCOMPARE(certInfo.subject, QStringLiteral("J\u00D5EORG, JAAK-KRISTJAN, 38001085718"));
196199

197-
QCOMPARE(controller->result()["unverifiedCertificate"].toString().left(25),
198-
QStringLiteral("MIIGRzCCBC+gAwIBAgIQRA7X0"));
200+
QCOMPARE(controller->result()[QStringLiteral("unverifiedCertificate")].toString().left(25),
201+
QStringLiteral("MIIEAzCCA2WgAwIBAgIQOWkBW"));
199202
}
200203

201204
void WebEidTests::fromPunycode_decodesEeDomain()
202205
{
203-
QCOMPARE(fromPunycode(QUrl("https://xn--igusnunik-p7af.ee")),
206+
QCOMPARE(fromPunycode(QUrl(QStringLiteral("https://xn--igusnunik-p7af.ee"))),
204207
QStringLiteral("\u00F5igusn\u00F5unik.ee"));
205208
}
206209

@@ -216,7 +219,7 @@ void WebEidTests::quit_exits()
216219

217220
} catch (const std::exception& e) {
218221
QFAIL(QStringLiteral("WebEidTests::quit_exits() failed with exception: %s")
219-
.arg(e.what())
222+
.arg(QLatin1String(e.what()))
220223
.toUtf8());
221224
}
222225
}
@@ -248,7 +251,7 @@ void WebEidTests::initGetCert()
248251

249252
} catch (const std::exception& e) {
250253
QFAIL(QStringLiteral("WebEidTests::initGetCert() failed with exception: %s")
251-
.arg(e.what())
254+
.arg(QLatin1String(e.what()))
252255
.toUtf8());
253256
}
254257
}
@@ -264,23 +267,23 @@ void WebEidTests::initAuthenticate()
264267

265268
} catch (const std::exception& e) {
266269
QFAIL(QStringLiteral("WebEidTests::initAuthenticate() failed with exception: %s")
267-
.arg(e.what())
270+
.arg(QLatin1String(e.what()))
268271
.toUtf8());
269272
}
270273
}
271274

272275
void WebEidTests::initCard(bool withSigningScript)
273276
{
274277
try {
275-
PcscMock::setAtr(ESTEID_GEMALTO_V3_5_8_COLD_ATR);
278+
PcscMock::setAtr(ESTEID_IDEMIA_V1_ATR);
276279
const auto notExpiredCertScript = replaceCertValidUntilToNextYear(
277-
withSigningScript ? ESTEID_GEMALTO_V3_5_8_GET_SIGN_CERTIFICATE_AND_SIGNING
278-
: ESTEID_GEMALTO_V3_5_8_GET_AUTH_CERTIFICATE_AND_AUTHENTICATE);
280+
withSigningScript ? ESTEID_IDEMIA_V1_SELECT_SIGN_CERTIFICATE_AND_SIGNING
281+
: ESTEID_IDEMIA_V1_SELECT_AUTH_CERTIFICATE_AND_AUTHENTICATE);
279282
PcscMock::setApduScript(notExpiredCertScript);
280283

281284
} catch (const std::exception& e) {
282285
QFAIL(QStringLiteral("WebEidTests::initCard() failed with exception: %s")
283-
.arg(e.what())
286+
.arg(QLatin1String(e.what()))
284287
.toUtf8());
285288
}
286289
}

0 commit comments

Comments
 (0)