31
31
#include " mock-ui.hpp"
32
32
#include " getcommandhandler-mock.hpp"
33
33
34
+ #define NO_SIGNATURE
34
35
#include " select-certificate-script.hpp"
35
36
#include " atrs.hpp"
36
37
#include " changecertificatevaliduntil.hpp"
@@ -123,22 +124,22 @@ void WebEidTests::getCertificate_validCertificateHasExpectedCertificateSubject()
123
124
124
125
// assert
125
126
const auto certInfo = getCertAndPinInfoFromSignalSpy (certificateReadySpy);
126
- QCOMPARE (certInfo.subject , QStringLiteral (" M \u00C4 NNIK, MARI-LIIS, 61709210125 " ));
127
+ QCOMPARE (certInfo.subject , QStringLiteral (" J \u00D5 EORG, JAAK-KRISTJAN, 38001085718 " ));
127
128
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 ());
130
131
const auto cert = QSslCertificate (certBytes, QSsl::EncodingFormat::Der);
131
132
QVERIFY (!cert.isNull ());
132
- QCOMPARE (cert.subjectInfo (QSslCertificate::CommonName)[ 0 ] ,
133
- QStringLiteral (" M \u00C4 NNIK,MARI-LIIS,61709210125 " ));
133
+ QCOMPARE (cert.subjectInfo (QSslCertificate::CommonName). constFirst () ,
134
+ QStringLiteral (" J \u00D5 EORG,JAAK-KRISTJAN,38001085718 " ));
134
135
}
135
136
136
137
void WebEidTests::getCertificate_expiredCertificateHasExpectedCertificateSubject ()
137
138
{
138
139
// arrange
139
- PcscMock::setAtr (ESTEID_GEMALTO_V3_5_8_COLD_ATR );
140
+ PcscMock::setAtr (ESTEID_IDEMIA_V1_ATR );
140
141
PcscMock::setApduScript (
141
- replaceCertValidUntilTo2010 (ESTEID_GEMALTO_V3_5_8_GET_SIGN_CERTIFICATE_AND_SIGNING ));
142
+ replaceCertValidUntilTo2010 (ESTEID_IDEMIA_V1_SELECT_SIGN_CERTIFICATE_AND_SIGNING ));
142
143
143
144
initGetCert ();
144
145
@@ -150,14 +151,14 @@ void WebEidTests::getCertificate_expiredCertificateHasExpectedCertificateSubject
150
151
151
152
// assert
152
153
const auto certInfo = getCertAndPinInfoFromSignalSpy (certificateReadySpy);
153
- QCOMPARE (certInfo.subject , QStringLiteral (" M \u00C4 NNIK, MARI-LIIS, 61709210125 " ));
154
+ QCOMPARE (certInfo.subject , QStringLiteral (" J \u00D5 EORG, JAAK-KRISTJAN, 38001085718 " ));
154
155
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 ());
157
158
const auto cert = QSslCertificate (certBytes, QSsl::EncodingFormat::Der);
158
159
QVERIFY (!cert.isNull ());
159
- QCOMPARE (cert.subjectInfo (QSslCertificate::CommonName)[ 0 ] ,
160
- QStringLiteral (" M \u00C4 NNIK,MARI-LIIS,61709210125 " ));
160
+ QCOMPARE (cert.subjectInfo (QSslCertificate::CommonName). constFirst () ,
161
+ QStringLiteral (" J \u00D5 EORG,JAAK-KRISTJAN,38001085718 " ));
161
162
}
162
163
163
164
void WebEidTests::getCertificate_outputsSupportedAlgos ()
@@ -175,7 +176,9 @@ void WebEidTests::getCertificate_outputsSupportedAlgos()
175
176
runEventLoopVerifySignalsEmitted (certificateReadySpy);
176
177
177
178
// assert
178
- QCOMPARE (controller->result ()[" supportedSignatureAlgorithms" ].toList ()[0 ].toMap (), ES224_ALGO);
179
+ QCOMPARE (
180
+ controller->result ()[QStringLiteral (" supportedSignatureAlgorithms" )].toList ()[0 ].toMap (),
181
+ ES224_ALGO);
179
182
}
180
183
181
184
void WebEidTests::authenticate_validArgumentsResultInValidToken ()
@@ -192,15 +195,15 @@ void WebEidTests::authenticate_validArgumentsResultInValidToken()
192
195
193
196
// assert
194
197
const auto certInfo = getCertAndPinInfoFromSignalSpy (authenticateSpy);
195
- QCOMPARE (certInfo.subject , QStringLiteral (" M \u00C4 NNIK, MARI-LIIS, 61709210125 " ));
198
+ QCOMPARE (certInfo.subject , QStringLiteral (" J \u00D5 EORG, JAAK-KRISTJAN, 38001085718 " ));
196
199
197
- QCOMPARE (controller->result ()[" unverifiedCertificate" ].toString ().left (25 ),
198
- QStringLiteral (" MIIGRzCCBC+gAwIBAgIQRA7X0 " ));
200
+ QCOMPARE (controller->result ()[QStringLiteral ( " unverifiedCertificate" ) ].toString ().left (25 ),
201
+ QStringLiteral (" MIIEAzCCA2WgAwIBAgIQOWkBW " ));
199
202
}
200
203
201
204
void WebEidTests::fromPunycode_decodesEeDomain ()
202
205
{
203
- QCOMPARE (fromPunycode (QUrl (" https://xn--igusnunik-p7af.ee" )),
206
+ QCOMPARE (fromPunycode (QUrl (QStringLiteral ( " https://xn--igusnunik-p7af.ee" ) )),
204
207
QStringLiteral (" \u00F5 igusn\u00F5 unik.ee" ));
205
208
}
206
209
@@ -216,7 +219,7 @@ void WebEidTests::quit_exits()
216
219
217
220
} catch (const std::exception & e) {
218
221
QFAIL (QStringLiteral (" WebEidTests::quit_exits() failed with exception: %s" )
219
- .arg (e.what ())
222
+ .arg (QLatin1String ( e.what () ))
220
223
.toUtf8 ());
221
224
}
222
225
}
@@ -248,7 +251,7 @@ void WebEidTests::initGetCert()
248
251
249
252
} catch (const std::exception & e) {
250
253
QFAIL (QStringLiteral (" WebEidTests::initGetCert() failed with exception: %s" )
251
- .arg (e.what ())
254
+ .arg (QLatin1String ( e.what () ))
252
255
.toUtf8 ());
253
256
}
254
257
}
@@ -264,23 +267,23 @@ void WebEidTests::initAuthenticate()
264
267
265
268
} catch (const std::exception & e) {
266
269
QFAIL (QStringLiteral (" WebEidTests::initAuthenticate() failed with exception: %s" )
267
- .arg (e.what ())
270
+ .arg (QLatin1String ( e.what () ))
268
271
.toUtf8 ());
269
272
}
270
273
}
271
274
272
275
void WebEidTests::initCard (bool withSigningScript)
273
276
{
274
277
try {
275
- PcscMock::setAtr (ESTEID_GEMALTO_V3_5_8_COLD_ATR );
278
+ PcscMock::setAtr (ESTEID_IDEMIA_V1_ATR );
276
279
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 );
279
282
PcscMock::setApduScript (notExpiredCertScript);
280
283
281
284
} catch (const std::exception & e) {
282
285
QFAIL (QStringLiteral (" WebEidTests::initCard() failed with exception: %s" )
283
- .arg (e.what ())
286
+ .arg (QLatin1String ( e.what () ))
284
287
.toUtf8 ());
285
288
}
286
289
}
0 commit comments