diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index 3312e6f96..ef04fc6e4 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -98,8 +98,8 @@ if(NOT BUILD_DATE) endif() if(${QT_VERSION_MAJOR} STREQUAL "6") - find_package(Qt6 COMPONENTS Core5Compat SvgWidgets REQUIRED) - target_link_libraries(${PROJECT_NAME} Qt6::Core5Compat Qt6::SvgWidgets) + find_package(Qt6 COMPONENTS SvgWidgets REQUIRED) + target_link_libraries(${PROJECT_NAME} Qt6::SvgWidgets) endif() set_target_properties(${PROJECT_NAME} PROPERTIES diff --git a/client/CryptoDoc.cpp b/client/CryptoDoc.cpp index 1b5ad7754..e2d882177 100644 --- a/client/CryptoDoc.cpp +++ b/client/CryptoDoc.cpp @@ -226,14 +226,7 @@ CKey::CKey(const QSslCertificate &c) QString sn = c.subjectInfo("SN"); if(!gn.isEmpty() || !sn.isEmpty()) cn = QStringLiteral("%1 %2 %3").arg(gn, sn, c.personalCode()); - QString o = c.subjectInfo(QSslCertificate::Organization); - static const QRegularExpression rx(QStringLiteral("ESTEID \\((.*)\\)")); - QRegularExpressionMatch match = rx.match(o); - if(match.hasMatch()) - return QStringLiteral("%1 %2").arg(cn, match.captured(1)); - if(o == QLatin1String("ESTEID")) - return QStringLiteral("%1 %2").arg(cn, CryptoDoc::tr("ID-CARD")); int certType = c.type(); if(certType & SslCertificate::EResidentSubType) return QStringLiteral("%1 %2").arg(cn, CryptoDoc::tr("Digi-ID E-RESIDENT")); diff --git a/client/Diagnostics.cpp b/client/Diagnostics.cpp index 3e42444ca..ba16ad252 100644 --- a/client/Diagnostics.cpp +++ b/client/Diagnostics.cpp @@ -131,31 +131,7 @@ void Diagnostics::generalInfo(QTextStream &s) s << "
"; return r; }; - if(printAID(QStringLiteral("AID35"), APDU("00A40400 0F D23300000045737445494420763335")) || - printAID(QStringLiteral("UPDATER_AID"), APDU("00A40400 0A D2330000005550443101"))) - { - reader.transfer(APDU("00A4000C")); - reader.transfer(APDU("00A4010C 02 EEEE")); - reader.transfer(APDU("00A4020C 02 5044")); - QByteArray row = APDU("00B20004 00"); - row[2] = 0x07; // read card id - s << "ID - " << reader.transfer(row).data << "
"; - - QString appletVersion; - if(QPCSCReader::Result data = reader.transfer(APDU("00CA0100 00"))) - { - for(int i = 0; i < data.data.size(); ++i) - { - if(i == 0) - appletVersion = QString::number(quint8(data.data[i])); - else - appletVersion += QStringLiteral(".%1").arg(quint8(data.data[i])); - } - } - if(!appletVersion.isEmpty()) - s << tr("Applet version") << ": " << appletVersion << "
"; - } - else if(printAID(QStringLiteral("AID_IDEMIA"), APDU("00A40400 10 A000000077010800070000FE00000100")) || + if(printAID(QStringLiteral("AID_IDEMIA"), APDU("00A40400 10 A000000077010800070000FE00000100")) || printAID(QStringLiteral("AID_OT"), APDU("00A4040C 0D E828BD080FF2504F5420415750")) || printAID(QStringLiteral("AID_QSCD"), APDU("00A4040C 10 51534344204170706C69636174696F6E"))) { diff --git a/client/MainWindow_MyEID.cpp b/client/MainWindow_MyEID.cpp index 8c4303cac..efe777b58 100644 --- a/client/MainWindow_MyEID.cpp +++ b/client/MainWindow_MyEID.cpp @@ -139,7 +139,7 @@ bool MainWindow::validateCardError(QSmartCardData::PinType type, QSmartCardData: void MainWindow::showNotification( const QString &msg, bool isSuccess ) { - FadeInNotification* notification = new FadeInNotification(this, + auto *notification = new FadeInNotification(this, isSuccess ? QStringLiteral("#ffffff") : QStringLiteral("#353739"), isSuccess ? QStringLiteral("#498526") : QStringLiteral("#F8DDA7"), 110); notification->start(msg, 750, 3000, 1200); @@ -182,11 +182,6 @@ void MainWindow::updateCardWarnings(const QSmartCardData &data) ui->myEid->invalidIcon(true); warnings->showWarning(WarningText(WarningType::CertExpiredWarning)); } - else if(data.authCert().publicKey().algorithm() == QSsl::Rsa) - { - ui->myEid->invalidIcon(true); - warnings->showWarning(WarningText(WarningType::CertRevokedWarning)); - } else if(expiresIn <= 105 * DAY) { ui->myEid->warningIcon(true); diff --git a/client/QSmartCard.cpp b/client/QSmartCard.cpp index 8f237a039..a4f848367 100644 --- a/client/QSmartCard.cpp +++ b/client/QSmartCard.cpp @@ -31,7 +31,6 @@ #include #include #include -#include Q_LOGGING_CATEGORY(CLog, "qdigidoc4.QSmartCard") @@ -65,7 +64,6 @@ QVariant QSmartCardData::data(PersonalDataType type) const SslCertificate QSmartCardData::authCert() const { return d->authCert; } SslCertificate QSmartCardData::signCert() const { return d->signCert; } quint8 QSmartCardData::retryCount(PinType type) const { return d->retry.value(type); } -ulong QSmartCardData::usageCount(PinType type) const { return d->usage.value(type); } quint8 QSmartCardData::minPinLen(QSmartCardData::PinType type) { @@ -114,184 +112,6 @@ QPCSCReader::Result Card::transfer(QPCSCReader *reader, bool verify, const QByte -const QByteArray EstEIDCard::ESTEIDDF = APDU("00A4010C 02 EEEE"); -const QByteArray EstEIDCard::PERSONALDATA = APDU("00A4020C 02 5044"); -const QTextCodec* EstEIDCard::codec = QTextCodec::codecForName("Windows-1252"); - -QPCSCReader::Result EstEIDCard::change(QPCSCReader *reader, QSmartCardData::PinType type, const QString &pin_, const QString &newpin_) const -{ - QByteArray cmd = CHANGE; - QByteArray newpin = newpin_.toUtf8(); - QByteArray pin = pin_.toUtf8(); - cmd[3] = char(type == QSmartCardData::PukType ? 0 : type); - cmd[4] = char(pin.size() + newpin.size()); - return transfer(reader, false, cmd + pin + newpin, type, quint8(pin.size()), true); -} - -bool EstEIDCard::loadPerso(QPCSCReader *reader, QSmartCardDataPrivate *d) const -{ - static const QByteArray AUTHCERT = APDU("00A40200 02 AACE"); - static const QByteArray SIGNCERT = APDU("00A40200 02 DDCE"); - - if(reader->transfer(MASTER_FILE) && - reader->transfer(ESTEIDDF) && - d->data.isEmpty() && reader->transfer(PERSONALDATA)) - { - QByteArray cmd = READRECORD; - for(char data = QSmartCardData::SurName; data != QSmartCardData::Comment4; ++data) - { - cmd[2] = data; - QPCSCReader::Result result = reader->transfer(cmd); - if(!result) - return false; - QString record = codec->toUnicode(result.data.trimmed()); - if(record == QChar(0)) - record.clear(); - switch(data) - { - case QSmartCardData::BirthDate: - case QSmartCardData::IssueDate: - d->data[QSmartCardData::PersonalDataType(data)] = QDate::fromString(record, QStringLiteral("dd.MM.yyyy")); - break; - case QSmartCardData::Expiry: - d->data[QSmartCardData::PersonalDataType(data)] = QDateTime::fromString(record, QStringLiteral("dd.MM.yyyy")).addDays(1).addSecs(-1); - break; - default: - d->data[QSmartCardData::PersonalDataType(data)] = record; - break; - } - } - } - bool readFailed = false; - auto readCert = [&](const QByteArray &file) { - // Workaround some cards, add Le to end - QPCSCReader::Result data = reader->transfer(file + APDU(reader->protocol() == QPCSCReader::T1 ? "00" : "")); - if(!data) - return QSslCertificate(); - QHash fci = QSmartCard::parseFCI(data.data); - int size = fci.contains(0x85) ? quint8(fci[0x85][0]) << 8 | quint8(fci[0x85][1]) : 0x0600; - QByteArray cert; - QByteArray cmd = READBINARY; - while(cert.size() < size) - { - cmd[2] = char(cert.size() >> 8); - cmd[3] = char(cert.size()); - data = reader->transfer(cmd); - if(!data) - { - readFailed = true; - return QSslCertificate(); - } - cert += data.data; - } - return QSslCertificate(cert, QSsl::Der); - }; - if(d->authCert.isNull()) - d->authCert = readCert(AUTHCERT); - if(d->signCert.isNull()) - d->signCert = readCert(SIGNCERT); - if(readFailed) - return false; - d->data[QSmartCardData::Email] = d->authCert.subjectAlternativeNames().values(QSsl::EmailEntry).value(0); - return updateCounters(reader, d); -} - -QPCSCReader::Result EstEIDCard::replace(QPCSCReader *reader, QSmartCardData::PinType type, const QString &puk_, const QString &pin_) const -{ - QPCSCReader::Result result; - if(!reader->isPinPad()) //Verify PUK. Not for pinpad. - { - result = verify(reader, QSmartCardData::PukType, puk_); - if(!result) - return result; - } - - // Replace PIN with PUK - QByteArray pin = pin_.toUtf8(); - QByteArray puk = puk_.toUtf8(); - QByteArray cmd = Card::REPLACE; - cmd[3] = type; - cmd[4] = char(puk.size() + pin.size()); - return transfer(reader, false, cmd + puk + pin, type, 0, true); -} - -QByteArray EstEIDCard::sign(QPCSCReader *reader, const QByteArray &dgst) const -{ - if(!reader->transfer(APDU("0022F301")) || // 00")) || // Compatibilty for some cards // SECENV1 - !reader->transfer(APDU("002241B8 02 8300"))) //Key reference, 8303801100 - return {}; - QByteArray cmd = MUTUAL_AUTH; - cmd[4] = char(dgst.size()); - cmd.insert(5, dgst); - return reader->transfer(cmd).data; -} - -bool EstEIDCard::updateCounters(QPCSCReader *reader, QSmartCardDataPrivate *d) const -{ - static const QByteArray KEYPOINTER = APDU("00A4020C 02 0033"); - static const QByteArray KEYUSAGE = APDU("00A4020C 02 0013"); - static const QByteArray PINRETRY = APDU("00A4020C 02 0016"); - - if(!reader->transfer(MASTER_FILE) || - !reader->transfer(PINRETRY)) - return false; - - QByteArray cmd = READRECORD; - for(int i = QSmartCardData::Pin1Type; i <= QSmartCardData::PukType; ++i) - { - cmd[2] = char(i); - QPCSCReader::Result data = reader->transfer(cmd); - if(!data) - return false; - d->retry[QSmartCardData::PinType(i)] = quint8(data.data[5]); - } - - if(!reader->transfer(ESTEIDDF) || - !reader->transfer(KEYPOINTER)) - return false; - - cmd[2] = 1; - QPCSCReader::Result data = reader->transfer(cmd); - if(!data) - return false; - - /* - * SIGN1 0100 1 - * SIGN2 0200 2 - * AUTH1 1100 3 - * AUTH2 1200 4 - */ - quint8 signkey = data.data.at(0x13) == 0x01 && data.data.at(0x14) == 0x00 ? 1 : 2; - quint8 authkey = data.data.at(0x09) == 0x11 && data.data.at(0x0A) == 0x00 ? 3 : 4; - - if(!reader->transfer(KEYUSAGE)) - return false; - - cmd[2] = char(authkey); - data = reader->transfer(cmd); - if(!data) - return false; - d->usage[QSmartCardData::Pin1Type] = 0xFFFFFF - ((quint8(data.data[12]) << 16) + (quint8(data.data[13]) << 8) + quint8(data.data[14])); - - cmd[2] = char(signkey); - data = reader->transfer(cmd); - if(!data) - return false; - d->usage[QSmartCardData::Pin2Type] = 0xFFFFFF - ((quint8(data.data[12]) << 16) + (quint8(data.data[13]) << 8) + quint8(data.data[14])); - return true; -} - -QPCSCReader::Result EstEIDCard::verify(QPCSCReader *reader, QSmartCardData::PinType type, const QString &pin_) const -{ - QByteArray pin = pin_.toUtf8(); - QByteArray cmd = VERIFY; - cmd[3] = char(type == QSmartCardData::PukType ? 0 : type); - cmd[4] = char(pin.size()); - return transfer(reader, true, cmd + pin, type, 0, true); -} - - - const QByteArray IDEMIACard::AID = APDU("00A40400 10 A000000077010800070000FE00000100"); const QByteArray IDEMIACard::AID_OT = APDU("00A4040C 0D E828BD080FF2504F5420415750"); const QByteArray IDEMIACard::AID_QSCD = APDU("00A4040C 10 51534344204170706C69636174696F6E"); @@ -452,8 +272,6 @@ QByteArray IDEMIACard::sign(QPCSCReader *reader, const QByteArray &dgst) const bool IDEMIACard::updateCounters(QPCSCReader *reader, QSmartCardDataPrivate *d) const { - d->usage[QSmartCardData::Pin1Type] = 0; - d->usage[QSmartCardData::Pin2Type] = 0; reader->transfer(AID); if(auto data = reader->transfer(APDU("00CB3FFF 0A 4D087006BF810102A08000"))) d->retry[QSmartCardData::Pin1Type] = quint8(data.data[13]); @@ -684,10 +502,7 @@ void QSmartCard::reloadCard(const TokenData &token) t->reader = selectedReader->name(); t->pinpad = selectedReader->isPinPad(); delete d->card; - if(IDEMIACard::isSupported(selectedReader->atr())) - d->card = new IDEMIACard(); - else - d->card = new EstEIDCard(); + d->card = new IDEMIACard(); if(d->card->loadPerso(selectedReader.data(), t)) { d->t.d = t; diff --git a/client/QSmartCard.h b/client/QSmartCard.h index ed2626f9b..16885b1ad 100644 --- a/client/QSmartCard.h +++ b/client/QSmartCard.h @@ -77,7 +77,6 @@ class QSmartCardData SslCertificate authCert() const; SslCertificate signCert() const; quint8 retryCount( PinType type ) const; - ulong usageCount( PinType type ) const; static quint8 minPinLen(QSmartCardData::PinType type); static QString typeString( PinType type ); @@ -106,7 +105,7 @@ class QSmartCard: public QObject }; explicit QSmartCard(QObject *parent = nullptr); - ~QSmartCard(); + ~QSmartCard() override; ErrorType change( QSmartCardData::PinType type, QWidget* parent, const QString &newpin, const QString &pin, const QString &title, const QString &bodyText ); QSmartCardData data() const; @@ -123,6 +122,7 @@ class QSmartCard: public QObject void dataChanged(const QSmartCardData &data); private: + Q_DISABLE_COPY_MOVE(QSmartCard) void reload(); class Private; diff --git a/client/QSmartCard_p.h b/client/QSmartCard_p.h index cc4416658..811cf0708 100644 --- a/client/QSmartCard_p.h +++ b/client/QSmartCard_p.h @@ -30,8 +30,6 @@ #define APDU QByteArray::fromHex -class QTextCodec; - class Card { public: @@ -54,23 +52,6 @@ class Card static const QByteArray VERIFY; }; -class EstEIDCard: public Card -{ -public: - QPCSCReader::Result change(QPCSCReader *reader, QSmartCardData::PinType type, const QString &pin, const QString &newpin) const final; - bool loadPerso(QPCSCReader *reader, QSmartCardDataPrivate *d) const final; - QPCSCReader::Result replace(QPCSCReader *reader, QSmartCardData::PinType type, const QString &puk, const QString &pin) const final; - QByteArray sign(QPCSCReader *reader, const QByteArray &dgst) const final; - bool updateCounters(QPCSCReader *reader, QSmartCardDataPrivate *d) const final; - QPCSCReader::Result verify(QPCSCReader *reader, QSmartCardData::PinType type, const QString &pin) const final; - - static QString cardNR(QPCSCReader *reader); - - static const QTextCodec *codec; - static const QByteArray ESTEIDDF; - static const QByteArray PERSONALDATA; -}; - class IDEMIACard: public Card { public: @@ -107,6 +88,5 @@ class QSmartCardDataPrivate: public QSharedData QHash data; SslCertificate authCert, signCert; QHash retry; - QHash usage; bool pinpad = false; }; diff --git a/client/common_enums.h b/client/common_enums.h index b37184c2f..534eae837 100644 --- a/client/common_enums.h +++ b/client/common_enums.h @@ -86,7 +86,6 @@ enum WarningType { CertExpiredWarning, CertExpiryWarning, - CertRevokedWarning, UnblockPin1Warning, UnblockPin2Warning, diff --git a/client/dialogs/SettingsDialog.cpp b/client/dialogs/SettingsDialog.cpp index b07b9a0c5..ae378e42c 100644 --- a/client/dialogs/SettingsDialog.cpp +++ b/client/dialogs/SettingsDialog.cpp @@ -238,15 +238,14 @@ SettingsDialog::SettingsDialog(int page, QWidget *parent) }); #ifdef Q_OS_WIN connect(ui->btnNavFromHistory, &QPushButton::clicked, this, [this] { - // remove certificates (having %ESTEID% text) from browsing history of Internet Explorer and/or Google Chrome, and do it for all users. + // remove certificates from browsing history of Internet Explorer and/or Google Chrome, and do it for all users. QList cache = qApp->signer()->cache(); CertStore s; for(const QSslCertificate &c: s.list()) { if(std::any_of(cache.cbegin(), cache.cend(), [&](const TokenData &token) { return token.cert() == c; })) continue; - if(c.subjectInfo(QSslCertificate::Organization).join(QString()).contains(QStringLiteral("ESTEID"), Qt::CaseInsensitive) || - c.issuerInfo(QSslCertificate::CommonName).join(QString()).contains(QStringLiteral("KLASS3-SK"), Qt::CaseInsensitive) || + if(c.issuerInfo(QSslCertificate::CommonName).join(QString()).contains(QStringLiteral("KLASS3-SK"), Qt::CaseInsensitive) || c.issuerInfo(QSslCertificate::Organization).contains(QStringLiteral("SK ID Solutions AS"), Qt::CaseInsensitive)) s.remove( c ); } diff --git a/client/translations/en.ts b/client/translations/en.ts index 1c6a14509..d131e2bda 100644 --- a/client/translations/en.ts +++ b/client/translations/en.ts @@ -763,10 +763,6 @@ TSL cache TSL cache - - Applet version - Applet version - true @@ -3055,10 +3051,6 @@ Additional licenses and components Certificate has expired! Certificate has expired! - - Certificate is revoked! - Certificate is revoked! - Certificate %1is valid%2 until %3 Certificate %1is valid%2 until %3 @@ -3103,16 +3095,6 @@ Additional licenses and components PUK code is blocked because the PUK code has been entered 3 times incorrectly. You can not unblock the PUK code yourself. As long as the PUK code is blocked, all eID options can be used, except PUK code. Please visit the service center to obtain new codes. <a href="https://www.politsei.ee/en/instructions/applying-for-an-id-card-for-an-adult/reminders-for-id-card-holders/">Additional information</a>. PUK code is blocked because the PUK code has been entered 3 times incorrectly. You can not unblock the PUK code yourself. <br><br>As long as the PUK code is blocked, all eID options can be used, except PUK code. <br><br>Please visit the service center to obtain new codes. <a href="https://www.politsei.ee/en/instructions/applying-for-an-id-card-for-an-adult/reminders-for-id-card-holders/">Additional information</a>. - - key has been used %1 times - pin1 - Authentication key has been used %1 times - - - key has been used %1 times - pin2 - Signature key has been used %1 times - PIN can be changed only using eToken utility PIN can be changed only using eToken utility @@ -3165,10 +3147,6 @@ Additional licenses and components PIN%1 can not be used because the certificate has expired. PIN%1 can not be used because the certificate has expired. - - PIN%1 can not be used because the certificate has revoked. - PIN%1 can not be used because the certificate has revoked. - Certificate status check failed. Please check your internet connection. Certificate status check failed. Please check your internet connection. @@ -3204,18 +3182,6 @@ Additional licenses and components WarningItem - - Certificates are revoked! - Certificates are revoked! - - - Additional information - Additional information - - - https://www.id.ee/en/article/the-majority-of-electronically-used-id-cards-were-renewed/ - https://www.id.ee/en/article/the-majority-of-electronically-used-id-cards-were-renewed/ - %n signatures are not valid! diff --git a/client/translations/et.ts b/client/translations/et.ts index 190fcd725..8cfb5f914 100644 --- a/client/translations/et.ts +++ b/client/translations/et.ts @@ -763,10 +763,6 @@ TSL cache TSL puhver - - Applet version - Apleti versioon - true @@ -3055,10 +3051,6 @@ Täiendavad litsentsid ja komponendid Certificate has expired! Sertifikaat on aegunud! - - Certificate is revoked! - Sertifikaat on tühistatud! - Certificate %1is valid%2 until %3 Sertifikaat %1kehtib%2 kuni %3 @@ -3111,16 +3103,6 @@ Täiendavad litsentsid ja komponendid PIN can be changed only using eToken utility PIN-koodi saab muuta ainult e-Templi tarkvaraga - - key has been used %1 times - pin1 - Sertifikaati on kasutatud %1 korda - - - key has been used %1 times - pin2 - Sertifikaati on kasutatud %1 korda - Certificate for Encryption Krüpteerimissertifikaat @@ -3165,10 +3147,6 @@ Täiendavad litsentsid ja komponendid Certificate is not valid. A valid certificate is required for electronic use. Sertifikaat ei kehti. Elektrooniliseks kasutamiseks on vaja kehtivat sertifikaati. - - PIN%1 can not be used because the certificate has revoked. - PIN%1 ei saa kasutada, kuna sertifikaat on tühistatud. - Certificate status check failed. Please check your internet connection. Sertifikaadi staatuse kontrollimine ebaõnnestus. Palun kontrolli internetiühendust. @@ -3204,18 +3182,6 @@ Täiendavad litsentsid ja komponendid WarningItem - - Certificates are revoked! - Sertifikaadid on tühistatud! - - - Additional information - Täiendav informatsioon - - - https://www.id.ee/en/article/the-majority-of-electronically-used-id-cards-were-renewed/ - https://www.id.ee/artikkel/uuendati-enamik-elektrooniliselt-kasutatud-id-kaartidest/ - %n signatures are not valid! diff --git a/client/translations/ru.ts b/client/translations/ru.ts index a1e9490ad..49fd88e2c 100644 --- a/client/translations/ru.ts +++ b/client/translations/ru.ts @@ -763,10 +763,6 @@ TSL cache TSL-буфер - - Applet version - Версия апплета - true @@ -3056,10 +3052,6 @@ Additional licenses and components Certificate has expired! Срок действия сертификата истек! - - Certificate is revoked! - Сертификат отозван! - Certificate %1is valid%2 until %3 Сертификат %1действителен%2 до %3 @@ -3108,16 +3100,6 @@ Additional licenses and components PIN can be changed only using eToken utility PIN-код можно сменить только при помощи программного обеспечения e-Tempel - - key has been used %1 times - pin1 - Сертификат использован %1 раз - - - key has been used %1 times - pin2 - Сертификат использован %1 раз - Certificate for Encryption Сертификат шифрования @@ -3166,10 +3148,6 @@ Additional licenses and components PIN%1 can not be used because the certificate has expired. PIN%1 не может быть использован, так как срок действия сертификата истек. - - PIN%1 can not be used because the certificate has revoked. - PIN%1 не может быть использован, так как сертификат был отменен. - Certificate status check failed. Please check your internet connection. Проверка статуса сертификата не удалась. Пожалуйста проверьте подключение к интернету. @@ -3205,18 +3183,6 @@ Additional licenses and components WarningItem - - Certificates are revoked! - Сертификаты отозваны! - - - Additional information - Дополнительная информация - - - https://www.id.ee/en/article/the-majority-of-electronically-used-id-cards-were-renewed/ - https://www.id.ee/ru/artikkel/obnovleno-bolshinstvo-zatronutyh-riskom-id-kart-kotorye-ispolzovalis-elektronno/ - %n signatures are not valid! diff --git a/client/widgets/VerifyCert.cpp b/client/widgets/VerifyCert.cpp index c5a71b0a3..600c0a5c5 100644 --- a/client/widgets/VerifyCert.cpp +++ b/client/widgets/VerifyCert.cpp @@ -34,18 +34,18 @@ VerifyCert::VerifyCert(QWidget *parent) { ui->setupUi( this ); - connect(ui->changePIN, &QPushButton::clicked, [=] { + connect(ui->changePIN, &QPushButton::clicked, this, [=] { emit changePinClicked( false, isBlockedPin ); }); - connect(ui->forgotPinLink, &QPushButton::clicked, [=] { + connect(ui->forgotPinLink, &QPushButton::clicked, this, [=] { emit changePinClicked( true, false ); // Change PIN with PUK code }); - connect(ui->details, &QPushButton::clicked, [=] { + connect(ui->details, &QPushButton::clicked, this, [=] { CertificateDetails::showCertificate(c, this, pinType == QSmartCardData::Pin1Type ? QStringLiteral("-auth") : QStringLiteral("-sign")); }); connect(ui->checkCert, &QPushButton::clicked, this, [=]{ - QString msg = tr("Read more here.");; + QString msg = tr("Read more here."); switch(c.validateOnline()) { case SslCertificate::Good: @@ -108,16 +108,12 @@ void VerifyCert::update() { bool isBlockedPuk = !cardData.isNull() && cardData.retryCount( QSmartCardData::PukType ) == 0; bool isTempelType = c.type() & SslCertificate::TempelType; - bool isRevoked = pinType != QSmartCardData::PukType && - cardData.authCert().publicKey().algorithm() == QSsl::Rsa; - isValidCert = c.isNull() || (c.isValid() && !isRevoked); + isValidCert = c.isNull() || c.isValid(); QString txt; QTextStream cert( &txt ); - if(isRevoked) - cert << tr("Certificate is revoked!"); - else if( !isValidCert ) + if( !isValidCert ) cert << tr("Certificate has expired!"); else { @@ -125,17 +121,11 @@ void VerifyCert::update() if(leftDays <= 105 && !c.isNull()) cert << ""; cert << tr("Certificate %1is valid%2 until %3").arg( - QStringLiteral(""), - QStringLiteral(""), + QLatin1String(""), + QLatin1String(""), DateTime(c.expiryDate().toLocalTime()).formatDate(QStringLiteral("dd. MMMM yyyy"))); if(leftDays <= 105 && !c.isNull()) cert << ""; - if(auto count = cardData.usageCount(pinType); count > 0) - { - cert << "
" << (pinType == QSmartCardData::Pin1Type ? - tr("key has been used %1 times", "pin1").arg(count) : - tr("key has been used %1 times", "pin2").arg(count)); - } } switch(pinType) { @@ -154,7 +144,6 @@ void VerifyCert::update() ui->forgotPinLink->setHidden(isBlockedPin || isBlockedPuk || isTempelType); ui->checkCert->setVisible(isValidCert); ui->error->setText( - isRevoked ? tr("PIN%1 can not be used because the certificate has revoked. ").arg(pinType) : !isValidCert ? tr("PIN%1 can not be used because the certificate has expired.").arg(pinType) : (isBlockedPin && isBlockedPuk) ? tr("PIN%1 has been blocked because PIN%1 code has been entered incorrectly 3 times.").arg(pinType) : isBlockedPin ? QStringLiteral("%1 %2").arg(tr("PIN%1 has been blocked because PIN%1 code has been entered incorrectly 3 times.").arg(pinType), tr("Unblock to reuse PIN%1.").arg(pinType)) : @@ -173,7 +162,8 @@ void VerifyCert::update() ui->error->setText( isBlockedPuk ? tr("PUK code is blocked because the PUK code has been entered 3 times incorrectly. " "You can not unblock the PUK code yourself. As long as the PUK code is blocked, all eID options can be used, except PUK code. " - "Please visit the service center to obtain new codes. Additional information.") : + "Please visit the service center to obtain new codes. " + "Additional information.") : QString() ); ui->widget->setHidden(isBlockedPuk); @@ -183,39 +173,35 @@ void VerifyCert::update() if( !isValidCert && pinType != QSmartCardData::PukType ) { setStyleSheet(QStringLiteral("opacity: 0.25; background-color: #F9EBEB;")); - ui->changePIN->setStyleSheet( - "QPushButton { border-radius: 2px; border: none; color: #ffffff; background-color: #006EB5;}" - "QPushButton:pressed { background-color: #41B6E6;}" - "QPushButton:hover:!pressed { background-color: #008DCF;}" - "QPushButton:disabled { background-color: #BEDBED;};" - ); - ui->error->setStyleSheet( - "padding: 6px 6px 6px 6px;" - "line-height: 14px;" - "border: 1px solid #c53e3e;" - "border-radius: 2px;" - "background-color: #e09797;" - "color: #5c1c1c;" - ); + ui->changePIN->setStyleSheet(QStringLiteral( + "QPushButton { border-radius: 2px; border: none; color: #ffffff; background-color: #006EB5;}" + "QPushButton:pressed { background-color: #41B6E6;}" + "QPushButton:hover:!pressed { background-color: #008DCF;}" + "QPushButton:disabled { background-color: #BEDBED;};")); + ui->error->setStyleSheet(QStringLiteral( + "padding: 6px 6px 6px 6px;" + "line-height: 14px;" + "border: 1px solid #c53e3e;" + "border-radius: 2px;" + "background-color: #e09797;" + "color: #5c1c1c;")); ui->nameIcon->load(QStringLiteral(":/images/icon_alert_red.svg")); ui->nameIcon->show(); } else if( isBlockedPin ) { setStyleSheet(QStringLiteral("opacity: 0.25; background-color: #fcf5ea;")); - ui->changePIN->setStyleSheet( - "QPushButton { border-radius: 2px; border: none; color: #ffffff; background-color: #006EB5;}" - "QPushButton:pressed { background-color: #41B6E6;}" - "QPushButton:hover:!pressed { background-color: #008DCF;}" - "QPushButton:disabled { background-color: #BEDBED;};" - ); - ui->error->setStyleSheet( - "padding: 6px 6px 6px 6px;" - "line-height: 14px;" - "border: 1px solid #e89c30;" - "border-radius: 2px;" - "background-color: #F8DDA7;" - ); + ui->changePIN->setStyleSheet(QStringLiteral( + "QPushButton { border-radius: 2px; border: none; color: #ffffff; background-color: #006EB5;}" + "QPushButton:pressed { background-color: #41B6E6;}" + "QPushButton:hover:!pressed { background-color: #008DCF;}" + "QPushButton:disabled { background-color: #BEDBED;};")); + ui->error->setStyleSheet(QStringLiteral( + "padding: 6px 6px 6px 6px;" + "line-height: 14px;" + "border: 1px solid #e89c30;" + "border-radius: 2px;" + "background-color: #F8DDA7;")); ui->nameIcon->load(QStringLiteral(":/images/icon_alert_orange.svg")); ui->nameIcon->show(); } @@ -233,7 +219,7 @@ void VerifyCert::update() if(pinType == QSmartCardData::Pin1Type) { adjustSize(); - if(VerifyCert *pukBox = parent()->findChild(QStringLiteral("pukBox"))) + if(auto *pukBox = parent()->findChild(QStringLiteral("pukBox"))) pukBox->ui->validUntil->setMinimumSize(ui->validUntil->size()); } } diff --git a/client/widgets/WarningItem.cpp b/client/widgets/WarningItem.cpp index d5656a212..1af1d8b1c 100644 --- a/client/widgets/WarningItem.cpp +++ b/client/widgets/WarningItem.cpp @@ -94,11 +94,6 @@ void WarningItem::lookupWarning() ui->warningText->setTextInteractionFlags(Qt::TextBrowserInteraction); ui->warningText->setOpenExternalLinks(true); break; - case ria::qdigidoc4::CertRevokedWarning: - warnText.text = tr("Certificates are revoked!"); - warnText.url = tr("https://www.id.ee/en/article/the-majority-of-electronically-used-id-cards-were-renewed/"); - warnText.details = tr("Additional information").toUpper(); - break; case ria::qdigidoc4::UnblockPin1Warning: warnText.text = QStringLiteral("%1 %2").arg(VerifyCert::tr("PIN%1 has been blocked because PIN%1 code has been entered incorrectly 3 times.").arg(1), VerifyCert::tr("Unblock to reuse PIN%1.").arg(1)); warnText.url = QStringLiteral("#unblock-PIN1"); diff --git a/client/widgets/WarningList.cpp b/client/widgets/WarningList.cpp index eb8797ce5..37bd98808 100644 --- a/client/widgets/WarningList.cpp +++ b/client/widgets/WarningList.cpp @@ -17,15 +17,15 @@ WarningList::WarningList(Ui::MainWindow *main, QWidget *parent) parent->installEventFilter(this); } -bool WarningList::appearsOnPage(WarningItem *warning, int page) const +bool WarningList::appearsOnPage(WarningItem *warning, int page) { return warning->page() == page || warning->page() == -1; } void WarningList::clearMyEIDWarnings() { - static const QList warningTypes {CertExpiredWarning, CertExpiryWarning, CertRevokedWarning, UnblockPin1Warning, UnblockPin2Warning}; - for(auto warning: warnings) + static const QList warningTypes {CertExpiredWarning, CertExpiryWarning, UnblockPin1Warning, UnblockPin2Warning}; + for(auto *warning: warnings) { if(warningTypes.contains(warning->warningType()) || warning->page() == MyEid) closeWarning(warning); @@ -35,7 +35,7 @@ void WarningList::clearMyEIDWarnings() void WarningList::closeWarning(int warningType) { - for(auto warning: warnings) + for(auto *warning: warnings) { if(warningType == warning->warningType()) closeWarning(warning); @@ -51,7 +51,7 @@ void WarningList::closeWarning(WarningItem *warning) void WarningList::closeWarnings(int page) { - for(auto warning: warnings) + for(auto *warning: warnings) { if(warning->page() == page) closeWarning(warning); @@ -64,7 +64,7 @@ bool WarningList::eventFilter(QObject *object, QEvent *event) if(object != parent() || event->type() != QEvent::MouseButtonPress) return QObject::eventFilter(object, event); - for(auto warning: warnings) + for(auto *warning: warnings) { if(warning->underMouse()) { @@ -93,14 +93,14 @@ void WarningList::showWarning(const WarningText &warningText) { if(warningText.warningType) { - for(auto warning: warnings) + for(auto *warning: warnings) { if(warning->warningType() == warningText.warningType) return; } } - WarningItem *warning = new WarningItem(warningText, ui->page); - auto layout = qobject_cast(ui->page->layout()); + auto *warning = new WarningItem(warningText, ui->page); + auto *layout = qobject_cast(ui->page->layout()); warnings << warning; connect(warning, &WarningItem::linkActivated, this, &WarningList::warningClicked); layout->insertWidget(warnings.size(), warning); @@ -110,7 +110,7 @@ void WarningList::showWarning(const WarningText &warningText) void WarningList::updateRibbon(int page, bool expanded) { short count = 0; - for(auto warning: warnings) + for(auto *warning: warnings) { if(appearsOnPage(warning, page)) { @@ -133,7 +133,7 @@ void WarningList::updateWarnings() { int page = ui->startScreen->currentIndex(); int count = 0; - for(auto warning: warnings) + for(auto *warning: warnings) { if(appearsOnPage(warning, page)) count++; @@ -152,7 +152,7 @@ void WarningList::updateWarnings() { delete ribbon; ribbon = nullptr; - for(auto warning: warnings) + for(auto *warning: warnings) { if(appearsOnPage(warning, page)) warning->show(); @@ -162,7 +162,7 @@ void WarningList::updateWarnings() else if(!ribbon) { ribbon = new WarningRibbon(count - 3, ui->page); - auto layout = qobject_cast(ui->page->layout()); + auto *layout = qobject_cast(ui->page->layout()); layout->insertWidget(warnings.size() + 1, ribbon); ribbon->show(); } diff --git a/client/widgets/WarningList.h b/client/widgets/WarningList.h index e28a2505e..a718f67e8 100644 --- a/client/widgets/WarningList.h +++ b/client/widgets/WarningList.h @@ -42,7 +42,7 @@ class WarningList: public QObject void warningClicked(const QString &link); private: - bool appearsOnPage(WarningItem *warning, int page) const; + static bool appearsOnPage(WarningItem *warning, int page); void closeWarning(WarningItem *warning); bool eventFilter(QObject *object, QEvent *event) final; void updateRibbon(int page, bool expanded); diff --git a/qdigidoc4.wxs b/qdigidoc4.wxs index 622fbe3d7..e2c6929d6 100644 --- a/qdigidoc4.wxs +++ b/qdigidoc4.wxs @@ -155,7 +155,6 @@ msiexec /a libdigidocpp-3.13.8.1378.msi /qn TARGETDIR=C:\target -