From 1f848cf3ffe4c7545047472e19e5d879b564871a Mon Sep 17 00:00:00 2001 From: Jelena Sanko Date: Mon, 20 Sep 2021 09:47:16 +0300 Subject: [PATCH] Add more specific info for OpenSSLExceptions (#970) * Add new OpenSSL Exceptions Signed-off-by: Jelena Sanko * Add SiVa exception handling and update translations IB-6714 Signed-off-by: Raul Metsma Co-authored-by: Raul Metsma --- CMakeLists.txt | 4 ++-- client/DigiDoc.cpp | 31 +++++++++++++++++++++++++++---- client/translations/en.ts | 12 ++++++++++++ client/translations/et.ts | 12 ++++++++++++ client/translations/ru.ts | 12 ++++++++++++ 5 files changed, 65 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 51ad376b0..faab68ac4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.10) if(POLICY CMP0074) cmake_policy(SET CMP0074 NEW) endif() -project(qdigidoc4 VERSION 4.2.9) +project(qdigidoc4 VERSION 4.2.11) set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/modules") set(CMAKE_INCLUDE_CURRENT_DIR ON) @@ -12,7 +12,7 @@ include( GNUInstallDirs ) include( VersionInfo ) find_package( PKCS11 ) -find_package( LibDigiDocpp 3.14.5 REQUIRED ) +find_package( LibDigiDocpp 3.14.8 REQUIRED ) find_package( LDAP REQUIRED ) find_package( Qt5 5.9.0 REQUIRED COMPONENTS Core Widgets Network PrintSupport Svg LinguistTools ) diff --git a/client/DigiDoc.cpp b/client/DigiDoc.cpp index f8236a06f..b43dc837a 100644 --- a/client/DigiDoc.cpp +++ b/client/DigiDoc.cpp @@ -536,10 +536,19 @@ bool DigiDoc::open( const QString &file ) } catch( const Exception &e ) { - if(e.code() == Exception::NetworkError) + switch(e.code()) + { + case Exception::NetworkError: setLastError(tr("Connecting to SiVa server failed! Please check your internet connection."), e); - else + break; + case Exception::HostNotFound: + case Exception::InvalidUrl: + setLastError(tr("Connecting to SiVa server failed! Please check your internet connection and network settings."), e); + break; + default: setLastError(tr("An error occurred while opening the document."), e); + break; + } } return false; } @@ -560,7 +569,11 @@ void DigiDoc::parseException(const Exception &e, QStringList &causes, Exception: case Exception::PINFailed: case Exception::PINIncorrect: case Exception::PINLocked: + case Exception::NetworkError: + case Exception::HostNotFound: + case Exception::InvalidUrl: code = e.code(); + break; default: break; } for(const Exception &c: e.causes()) @@ -640,6 +653,9 @@ void DigiDoc::setLastError( const QString &msg, const Exception &e ) qApp->showWarning(tr("PIN Incorrect"), causes.join('\n')); break; case Exception::PINLocked: qApp->showWarning(tr("PIN Locked. Unblock to reuse PIN."), causes.join('\n')); break; + case Exception::NetworkError: // use passed message for these thre exceptions + case Exception::HostNotFound: + case Exception::InvalidUrl: default: qApp->showWarning(msg, causes.join('\n')); break; } @@ -669,12 +685,19 @@ bool DigiDoc::sign(const QString &city, const QString &state, const QString &zip QStringList causes; Exception::ExceptionCode code = Exception::General; parseException(e, causes, code); - if(code == Exception::PINIncorrect) + switch(code) { + case Exception::PINIncorrect: qApp->showWarning(tr("PIN Incorrect")); return sign(city, state, zip, country, role, signer); + case Exception::NetworkError: + case Exception::HostNotFound: + qApp->showWarning(tr("Failed to sign container. Please check the access to signing services and network settings."), causes.join('\n')); break; + case Exception::InvalidUrl: + qApp->showWarning(tr("Failed to sign container. Signing service URL is incorrect."), causes.join('\n')); break; + default: + setLastError(tr("Failed to sign container"), e); break; } - setLastError(tr("Failed to sign container."), e); } return false; } diff --git a/client/translations/en.ts b/client/translations/en.ts index 8192306ef..458538f6c 100644 --- a/client/translations/en.ts +++ b/client/translations/en.ts @@ -867,6 +867,18 @@ Signed document in PDF and DDOC format will be transmitted to the Digital Signature Validation Service SiVa to verify the validity of the digital signature. Read more information about transmitted data to Digital Signature Validation service from <a href="https://www.id.ee/en/article/data-protection-conditions-for-the-id-software-of-the-national-information-system-authority/">here</a>.<br />Do you want to continue? Signed document in PDF and DDOC format will be transmitted to the Digital Signature Validation Service SiVa to verify the validity of the digital signature. Read more information about transmitted data to Digital Signature Validation service from <a href="https://www.id.ee/en/article/data-protection-conditions-for-the-id-software-of-the-national-information-system-authority/">here</a>.<br />Do you want to continue? + + Connecting to SiVa server failed! Please check your internet connection and network settings. + Connecting to SiVa server failed! Please check your internet connection and network settings. + + + Failed to sign container. Please check the access to signing services and network settings. + Failed to sign container. Please check the access to signing services and network settings. + + + Failed to sign container. Signing service URL is incorrect. + Failed to sign container. Signing service URL is incorrect. + DocumentModel diff --git a/client/translations/et.ts b/client/translations/et.ts index 02bb4023e..71491b328 100644 --- a/client/translations/et.ts +++ b/client/translations/et.ts @@ -867,6 +867,18 @@ Signed document in PDF and DDOC format will be transmitted to the Digital Signature Validation Service SiVa to verify the validity of the digital signature. Read more information about transmitted data to Digital Signature Validation service from <a href="https://www.id.ee/en/article/data-protection-conditions-for-the-id-software-of-the-national-information-system-authority/">here</a>.<br />Do you want to continue? PDF ja DDOC formaadis digitaalallkirjade kehtivuse kontrollimiseks edastatakse fail valideerimisteenusele SiVa. Digitaalallkirjade kehtivuse kontrollimisel edastatud andmete kohta loe lähemalt <a href="https://www.id.ee/artikkel/riigi-infosusteemi-ameti-id-tarkvara-andmekaitsetingimused/">siit</a>.<br />Kas soovid jätkata? + + Connecting to SiVa server failed! Please check your internet connection and network settings. + Viga SiVa serveriga ühenduse saamisel! Palun kontrolli internetiühendust ja võrgu sätteid. + + + Failed to sign container. Please check the access to signing services and network settings. + Ümbriku allkirjastamine ebaõnnestus. Palun kontrolli allkirjastamiseks vajalike teenuste ligipääsu ja võrgu sätteid. + + + Failed to sign container. Signing service URL is incorrect. + Ümbriku allkirjastamine ebaõnnestus. Allkirjastamise teenuse URL ei ole korrektne. + DocumentModel diff --git a/client/translations/ru.ts b/client/translations/ru.ts index d5927d108..2be43f8b7 100644 --- a/client/translations/ru.ts +++ b/client/translations/ru.ts @@ -869,6 +869,18 @@ Signed document in PDF and DDOC format will be transmitted to the Digital Signature Validation Service SiVa to verify the validity of the digital signature. Read more information about transmitted data to Digital Signature Validation service from <a href="https://www.id.ee/en/article/data-protection-conditions-for-the-id-software-of-the-national-information-system-authority/">here</a>.<br />Do you want to continue? Для проверки действительности электронно-цифровых подписей в форматах PDF и DDOC файл пересылается в службу проверки цифровых подписей SiVa. Подробнее о данных, переданных для проверки действительности электронно-цифровых подписей, можно прочитать <a href="https://www.id.ee/ru/artikkel/usloviya-zashhity-dannyh-programmnogo-obespecheniya-id-karty-departamenta-gosudarstvennoj-infosistemy/">здесь</a>.<br />Желаете продолжить? + + Connecting to SiVa server failed! Please check your internet connection and network settings. + Ошибка при подключении с SiVa сервером! Пожалуйста проверьте интернет соединение и настройки сети. + + + Failed to sign container. Please check the access to signing services and network settings. + Не удалось подписать контейнер. Пожалуйста, проверьте настройки доступа и сеть для служб подписи. + + + Failed to sign container. Signing service URL is incorrect. + Не удалось подписать контейнер. Службы URL-адрес подписи неверены. + DocumentModel