From 58e979183e0b32317af3c4d331249e1967f25e27 Mon Sep 17 00:00:00 2001 From: Raul Metsma Date: Wed, 31 Jan 2024 13:26:44 +0200 Subject: [PATCH] Remove Smart-ID v1 protocol support IB-7958 Signed-off-by: Raul Metsma --- client/Application.h | 3 +++ client/Diagnostics.cpp | 6 ++---- client/Settings.cpp | 6 ++---- client/Settings.h | 2 +- client/dialogs/SmartIDProgress.cpp | 22 ++++++---------------- cmake | 2 +- 6 files changed, 15 insertions(+), 26 deletions(-) diff --git a/client/Application.h b/client/Application.h index 8c3adaf2d..e846ccdcc 100644 --- a/client/Application.h +++ b/client/Application.h @@ -107,3 +107,6 @@ class REOpenEvent: public QEvent enum { Type = QEvent::User + 1 }; REOpenEvent(): QEvent( QEvent::Type(Type) ) {} }; + +extern template QJsonValue Application::confValue(const QString &key); +extern template QJsonValue Application::confValue(const QLatin1String &key); diff --git a/client/Diagnostics.cpp b/client/Diagnostics.cpp index 3e42444ca..6d25ec0fe 100644 --- a/client/Diagnostics.cpp +++ b/client/Diagnostics.cpp @@ -35,10 +35,8 @@ void Diagnostics::generalInfo(QTextStream &s) #ifdef CONFIG_URL << "
CONFIG_URL: " << CONFIG_URL #endif - << "
SID-PROXY-URL: " << Application::confValue(QLatin1String("SID-PROXY-URL")).toString(QStringLiteral(SMARTID_URL)) - << "
SIDV2-PROXY-URL: " << Application::confValue(QLatin1String("SIDV2-PROXY-URL")).toString(QStringLiteral(SMARTID_URL)) - << "
SID-SK-URL: " << Application::confValue(QLatin1String("SID-SK-URL")).toString(QStringLiteral(SMARTID_URL)) - << "
SIDV2-SK-URL: " << Application::confValue(QLatin1String("SIDV2-SK-URL")).toString(QStringLiteral(SMARTID_URL)) + << "
SIDV2-PROXY-URL: " << Settings::SID_PROXY_URL + << "
SIDV2-SK-URL: " << Settings::SID_SK_URL << "
MID-PROXY-URL: " << Settings::MID_PROXY_URL << "
MID-SK-URL: " << Settings::MID_SK_URL << "
RPUUID: " << (Settings::MID_UUID_CUSTOM ? tr("is set manually") : tr("is set by default")) diff --git a/client/Settings.cpp b/client/Settings.cpp index 1423d0fc8..da9dd4b92 100644 --- a/client/Settings.cpp +++ b/client/Settings.cpp @@ -56,13 +56,11 @@ const Option Settings::SID_UUID { QStringLiteral("SIDUUID") }; const Option Settings::SID_NAME { QStringLiteral("SIDNAME"), QStringLiteral("RIA DigiDoc") }; const Option Settings::SID_PROXY_URL { QStringLiteral("SID-PROXY-URL"), []{ return Application::confValue(QLatin1String("SIDV2-PROXY-URL")) - .toString(Application::confValue(QLatin1String("SID-PROXY-URL")) - .toString(QStringLiteral(SMARTID_URL))); + .toString(QStringLiteral(SMARTID_URL)); }}; const Option Settings::SID_SK_URL { QStringLiteral("SID-SK-URL"), []{ return Application::confValue(QLatin1String("SIDV2-SK-URL")) - .toString(Application::confValue(QLatin1String("SID-SK-URL")) - .toString(QStringLiteral(SMARTID_URL))); + .toString(QStringLiteral(SMARTID_URL)); }}; const Option Settings::SID_UUID_CUSTOM { QStringLiteral("SIDUUID-CUSTOM"), [] { return Settings::SID_UUID.isSet(); } }; diff --git a/client/Settings.h b/client/Settings.h index c0a40327f..27c7cf7c1 100644 --- a/client/Settings.h +++ b/client/Settings.h @@ -94,7 +94,7 @@ struct Settings } const QString KEY; const D DEFAULT {}; - std::function f; + std::function f {}; }; static const Option CDOC2_DEFAULT; diff --git a/client/dialogs/SmartIDProgress.cpp b/client/dialogs/SmartIDProgress.cpp index dbafd0f10..0e51a6d02 100644 --- a/client/dialogs/SmartIDProgress.cpp +++ b/client/dialogs/SmartIDProgress.cpp @@ -260,11 +260,7 @@ bool SmartIDProgress::init(const QString &country, const QString &idCode, const {"certificateLevel", "QUALIFIED"}, {"nonce", QUuid::createUuid().toString().remove('-').mid(1, 30)} }).toJson(); - if (d->req.url().path().contains(QLatin1String("v1"), Qt::CaseInsensitive)) { - d->req.setUrl(QUrl(QStringLiteral("%1/certificatechoice/pno/%2/%3").arg(d->URL, country, idCode))); - } else { - d->req.setUrl(QUrl(QStringLiteral("%1/certificatechoice/etsi/PNO%2-%3").arg(d->URL, country, idCode))); - } + d->req.setUrl(QUrl(QStringLiteral("%1/certificatechoice/etsi/PNO%2-%3").arg(d->URL, country, idCode))); qCDebug(SIDLog).noquote() << d->req.url() << data; d->manager->post(d->req, data); d->info->setText(tr("Open the Smart-ID application on your smart device and confirm device for signing.")); @@ -307,19 +303,13 @@ std::vector SmartIDProgress::sign(const std::string &method, cons {"certificateLevel", "QUALIFIED"}, {"hash", QString(QByteArray::fromRawData((const char*)digest.data(), int(digest.size())).toBase64())}, {"hashType", digestMethod}, + {"allowedInteractionsOrder", QJsonArray{QJsonObject{ + {"type", "confirmationMessageAndVerificationCodeChoice"}, + {"displayText200", "%1"} + }}}, }; - QString escape = tr("Sign document"); - if (d->req.url().path().contains(QLatin1String("v1"), Qt::CaseInsensitive)) { - req[QLatin1String("requestProperties")] = QJsonObject{{"vcChoice", true}}; - req[QLatin1String("displayText")] = "%1"; - } else { - req[QLatin1String("allowedInteractionsOrder")] = QJsonArray{QJsonObject{ - {"type", "confirmationMessageAndVerificationCodeChoice"}, - {"displayText200", "%1"} - }}; - escape = QStringLiteral("%1 %2").arg(tr("Sign document"), d->fileName); - } // Workaround SID proxy issues + QString escape = QStringLiteral("%1 %2").arg(tr("Sign document"), d->fileName); QByteArray data = QString::fromUtf8(QJsonDocument(req).toJson()).arg(escapeUnicode(escape)).toUtf8(); d->req.setUrl(QUrl(QStringLiteral("%1/signature/document/%2").arg(d->URL, d->documentNumber))); qCDebug(SIDLog).noquote() << d->req.url() << data; diff --git a/cmake b/cmake index 0ead93415..357e1cb23 160000 --- a/cmake +++ b/cmake @@ -1 +1 @@ -Subproject commit 0ead93415bb874083a46d8ef812d9d8b0dedb169 +Subproject commit 357e1cb2385ed6ff6e3b04aefcfd927659b00f60