@@ -31,17 +31,17 @@ using namespace electronic_id;
31
31
namespace
32
32
{
33
33
34
- CardCertificateAndPinInfo getCertificateWithStatusAndInfo (const ElectronicID::ptr& card ,
35
- const CertificateType certificateType)
34
+ EidCertificateAndPinInfo getCertificateWithStatusAndInfo (const ElectronicID::ptr& eid ,
35
+ const CertificateType certificateType)
36
36
{
37
- const auto certificateBytes = card ->getCertificate (certificateType);
37
+ const auto certificateBytes = eid ->getCertificate (certificateType);
38
38
39
39
QByteArray certificateDer (reinterpret_cast <const char *>(certificateBytes.data ()),
40
40
int (certificateBytes.size ()));
41
41
QSslCertificate certificate (certificateDer, QSsl::Der);
42
42
if (certificate.isNull ()) {
43
43
THROW (SmartCardChangeRequiredError,
44
- " Invalid certificate returned by electronic ID " + card ->name ());
44
+ " Invalid certificate returned by electronic ID " + eid ->name ());
45
45
}
46
46
47
47
auto subject = certificate.subjectInfo (QSslCertificate::CommonName).join (' ' );
@@ -61,16 +61,16 @@ CardCertificateAndPinInfo getCertificateWithStatusAndInfo(const ElectronicID::pt
61
61
CertificateInfo certInfo {
62
62
certificateType, certificate.expiryDate () < QDateTime::currentDateTimeUtc (),
63
63
certificate.effectiveDate () > QDateTime::currentDateTimeUtc (), std::move (subject)};
64
- PinInfo pinInfo {certificateType.isAuthentication () ? card ->authPinMinMaxLength ()
65
- : card ->signingPinMinMaxLength (),
66
- certificateType.isAuthentication () ? card ->authPinRetriesLeft ()
67
- : card ->signingPinRetriesLeft (),
68
- card ->smartcard ().readerHasPinPad ()};
64
+ PinInfo pinInfo {certificateType.isAuthentication () ? eid ->authPinMinMaxLength ()
65
+ : eid ->signingPinMinMaxLength (),
66
+ certificateType.isAuthentication () ? eid ->authPinRetriesLeft ()
67
+ : eid ->signingPinRetriesLeft (),
68
+ eid ->smartcard ().readerHasPinPad ()};
69
69
if (pinInfo.pinRetriesCount .first == 0 ) {
70
70
pinInfo.pinIsBlocked = true ;
71
71
}
72
72
73
- return {card , std::move (certificateDer), certificate, std::move (certInfo), std::move (pinInfo)};
73
+ return {eid , std::move (certificateDer), certificate, std::move (certInfo), std::move (pinInfo)};
74
74
}
75
75
76
76
} // namespace
@@ -83,27 +83,27 @@ CertificateReader::CertificateReader(const CommandWithArguments& cmd) : CommandH
83
83
}
84
84
}
85
85
86
- void CertificateReader::run (const std::vector<ElectronicID::ptr>& cards )
86
+ void CertificateReader::run (const std::vector<ElectronicID::ptr>& eids )
87
87
{
88
- REQUIRE_NOT_EMPTY_CONTAINS_NON_NULL_PTRS (cards )
88
+ REQUIRE_NOT_EMPTY_CONTAINS_NON_NULL_PTRS (eids )
89
89
90
90
certificateType = command.first == CommandType::AUTHENTICATE ? CertificateType::AUTHENTICATION
91
91
: CertificateType::SIGNING;
92
92
93
- std::vector<CardCertificateAndPinInfo> certInfos ;
94
- certInfos .reserve (cards .size ());
95
- for (const auto & card : cards ) {
93
+ std::vector<EidCertificateAndPinInfo> certAndPinInfos ;
94
+ certAndPinInfos .reserve (eids .size ());
95
+ for (const auto & eid : eids ) {
96
96
try {
97
- certInfos .push_back (getCertificateWithStatusAndInfo (card , certificateType));
97
+ certAndPinInfos .push_back (getCertificateWithStatusAndInfo (eid , certificateType));
98
98
} catch (const WrongCertificateTypeError&) {
99
99
// Ignore eIDs that don't support the given ceritifcate type.
100
100
}
101
101
}
102
102
103
- if (certInfos .empty ()) {
103
+ if (certAndPinInfos .empty ()) {
104
104
emit retry (RetriableError::NO_VALID_CERTIFICATE_AVAILABLE);
105
105
} else {
106
- emitCertificatesReady (certInfos );
106
+ emitCertificatesReady (certAndPinInfos );
107
107
}
108
108
}
109
109
@@ -117,12 +117,12 @@ void CertificateReader::connectSignals(const WebEidUI* window)
117
117
}
118
118
119
119
void CertificateReader::emitCertificatesReady (
120
- const std::vector<CardCertificateAndPinInfo >& certInfos )
120
+ const std::vector<EidCertificateAndPinInfo >& certAndPinInfos )
121
121
{
122
- if (certInfos .size () == 1 ) {
123
- emit singleCertificateReady (origin, certInfos [0 ]);
122
+ if (certAndPinInfos .size () == 1 ) {
123
+ emit singleCertificateReady (origin, certAndPinInfos [0 ]);
124
124
} else {
125
- emit multipleCertificatesReady (origin, certInfos );
125
+ emit multipleCertificatesReady (origin, certAndPinInfos );
126
126
}
127
127
}
128
128
0 commit comments