Skip to content

Commit

Permalink
Add more specific info for OpenSSLExceptions (#970)
Browse files Browse the repository at this point in the history
* Add new OpenSSL Exceptions

Signed-off-by: Jelena Sanko <jelena@raulwalter.com>

* Add SiVa exception handling and update translations

IB-6714

Signed-off-by: Raul Metsma <raul@metsma.ee>

Co-authored-by: Raul Metsma <raul@metsma.ee>
  • Loading branch information
jsanko and metsma authored Sep 20, 2021
1 parent 0497b7f commit 1f848cf
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 6 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 )

Expand Down
31 changes: 27 additions & 4 deletions client/DigiDoc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand All @@ -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())
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
}
Expand Down
12 changes: 12 additions & 0 deletions client/translations/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -867,6 +867,18 @@
<source>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 &lt;a href=&quot;https://www.id.ee/en/article/data-protection-conditions-for-the-id-software-of-the-national-information-system-authority/&quot;&gt;here&lt;/a&gt;.&lt;br /&gt;Do you want to continue?</source>
<translation>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 &lt;a href=&quot;https://www.id.ee/en/article/data-protection-conditions-for-the-id-software-of-the-national-information-system-authority/&quot;&gt;here&lt;/a&gt;.&lt;br /&gt;Do you want to continue?</translation>
</message>
<message>
<source>Connecting to SiVa server failed! Please check your internet connection and network settings.</source>
<translation>Connecting to SiVa server failed! Please check your internet connection and network settings.</translation>
</message>
<message>
<source>Failed to sign container. Please check the access to signing services and network settings.</source>
<translation>Failed to sign container. Please check the access to signing services and network settings.</translation>
</message>
<message>
<source>Failed to sign container. Signing service URL is incorrect.</source>
<translation>Failed to sign container. Signing service URL is incorrect.</translation>
</message>
</context>
<context>
<name>DocumentModel</name>
Expand Down
12 changes: 12 additions & 0 deletions client/translations/et.ts
Original file line number Diff line number Diff line change
Expand Up @@ -867,6 +867,18 @@
<source>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 &lt;a href=&quot;https://www.id.ee/en/article/data-protection-conditions-for-the-id-software-of-the-national-information-system-authority/&quot;&gt;here&lt;/a&gt;.&lt;br /&gt;Do you want to continue?</source>
<translation>PDF ja DDOC formaadis digitaalallkirjade kehtivuse kontrollimiseks edastatakse fail valideerimisteenusele SiVa. Digitaalallkirjade kehtivuse kontrollimisel edastatud andmete kohta loe lähemalt &lt;a href=&quot;https://www.id.ee/artikkel/riigi-infosusteemi-ameti-id-tarkvara-andmekaitsetingimused/&quot;&gt;siit&lt;/a&gt;.&lt;br /&gt;Kas soovid jätkata?</translation>
</message>
<message>
<source>Connecting to SiVa server failed! Please check your internet connection and network settings.</source>
<translation>Viga SiVa serveriga ühenduse saamisel! Palun kontrolli internetiühendust ja võrgu sätteid.</translation>
</message>
<message>
<source>Failed to sign container. Please check the access to signing services and network settings.</source>
<translation>Ümbriku allkirjastamine ebaõnnestus. Palun kontrolli allkirjastamiseks vajalike teenuste ligipääsu ja võrgu sätteid.</translation>
</message>
<message>
<source>Failed to sign container. Signing service URL is incorrect.</source>
<translation>Ümbriku allkirjastamine ebaõnnestus. Allkirjastamise teenuse URL ei ole korrektne.</translation>
</message>
</context>
<context>
<name>DocumentModel</name>
Expand Down
12 changes: 12 additions & 0 deletions client/translations/ru.ts
Original file line number Diff line number Diff line change
Expand Up @@ -869,6 +869,18 @@
<source>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 &lt;a href=&quot;https://www.id.ee/en/article/data-protection-conditions-for-the-id-software-of-the-national-information-system-authority/&quot;&gt;here&lt;/a&gt;.&lt;br /&gt;Do you want to continue?</source>
<translation>Для проверки действительности электронно-цифровых подписей в форматах PDF и DDOC файл пересылается в службу проверки цифровых подписей SiVa. Подробнее о данных, переданных для проверки действительности электронно-цифровых подписей, можно прочитать &lt;a href=&quot;https://www.id.ee/ru/artikkel/usloviya-zashhity-dannyh-programmnogo-obespecheniya-id-karty-departamenta-gosudarstvennoj-infosistemy/&quot;&gt;здесь&lt;/a&gt;.&lt;br /&gt;Желаете продолжить?</translation>
</message>
<message>
<source>Connecting to SiVa server failed! Please check your internet connection and network settings.</source>
<translation>Ошибка при подключении с SiVa сервером! Пожалуйста проверьте интернет соединение и настройки сети.</translation>
</message>
<message>
<source>Failed to sign container. Please check the access to signing services and network settings.</source>
<translation>Не удалось подписать контейнер. Пожалуйста, проверьте настройки доступа и сеть для служб подписи.</translation>
</message>
<message>
<source>Failed to sign container. Signing service URL is incorrect.</source>
<translation>Не удалось подписать контейнер. Службы URL-адрес подписи неверены.</translation>
</message>
</context>
<context>
<name>DocumentModel</name>
Expand Down

0 comments on commit 1f848cf

Please sign in to comment.