diff --git a/client/DigiDoc.cpp b/client/DigiDoc.cpp index fa12b8d5..b93ff592 100644 --- a/client/DigiDoc.cpp +++ b/client/DigiDoc.cpp @@ -447,14 +447,22 @@ bool DigiDoc::isError(bool failure, const QString &msg) const return !b || failure; } +bool DigiDoc::isCades() const +{ + return std::any_of(m_signatures.cbegin(), m_signatures.cend(), [](const DigiDocSignature &s) { + return s.profile().contains(QLatin1String("CADES"), Qt::CaseInsensitive); + }); +} + bool DigiDoc::isPDF() const { return b && b->mediaType() == "application/pdf"; } bool DigiDoc::isModified() const { return modified; } + bool DigiDoc::isSupported() const { - return b && b->mediaType() == "application/vnd.etsi.asic-e+zip"; + return b && b->mediaType() == "application/vnd.etsi.asic-e+zip" && !isCades(); } QString DigiDoc::mediaType() const diff --git a/client/DigiDoc.h b/client/DigiDoc.h index ea220eb8..8c83d34c 100644 --- a/client/DigiDoc.h +++ b/client/DigiDoc.h @@ -126,6 +126,7 @@ class DigiDoc: public QObject void clear(); DocumentModel *documentModel() const; QString fileName() const; + bool isCades() const; bool isPDF() const; bool isModified() const; bool isSupported() const; diff --git a/client/common_enums.h b/client/common_enums.h index aab7c49a..8fa9b081 100644 --- a/client/common_enums.h +++ b/client/common_enums.h @@ -94,6 +94,7 @@ enum WarningType { InvalidTimestampWarning, UnknownSignatureWarning, UnknownTimestampWarning, + UnsupportedAsicCadesWarning, UnsupportedDDocWarning, EmptyFileWarning, }; diff --git a/client/translations/en.ts b/client/translations/en.ts index e39837cd..e95c78a7 100644 --- a/client/translations/en.ts +++ b/client/translations/en.ts @@ -3288,6 +3288,10 @@ Additional licenses and components Certificates expire soon! Certificates expire soon! + + The current file is a ASiC container with CAdES signatures that is not supported currently. You are not allowed to add or remove signatures to this container. + The current file is a ASiC container with CAdES signatures that is not supported currently. You are not allowed to add or remove signatures to this container. + WarningRibbon diff --git a/client/translations/et.ts b/client/translations/et.ts index 97781458..520bebcf 100644 --- a/client/translations/et.ts +++ b/client/translations/et.ts @@ -3288,6 +3288,10 @@ Täiendavad litsentsid ja komponendid Certificates have expired! Sertifikaadid on aegunud! + + The current file is a ASiC container with CAdES signatures that is not supported currently. You are not allowed to add or remove signatures to this container. + Tegemist on CADES allkirja sisalduva ümbrikuga. Sellele ümbrikule ei saa allkirja lisada ega eemaldada. + WarningRibbon diff --git a/client/translations/ru.ts b/client/translations/ru.ts index 8a75030b..9dfb9aa9 100644 --- a/client/translations/ru.ts +++ b/client/translations/ru.ts @@ -3293,6 +3293,10 @@ Additional licenses and components Certificates expire soon! Срок действия сертификатов скоро истекает! + + The current file is a ASiC container with CAdES signatures that is not supported currently. You are not allowed to add or remove signatures to this container. + Этот контейнер содержит подпись КАДЕС. К данному контейнеру нельзя добавить или удалить из него подпись. + WarningRibbon diff --git a/client/widgets/ContainerPage.cpp b/client/widgets/ContainerPage.cpp index a01ef63c..de422179 100644 --- a/client/widgets/ContainerPage.cpp +++ b/client/widgets/ContainerPage.cpp @@ -332,6 +332,8 @@ void ContainerPage::transition(DigiDoc* container) emit warning(WarningText(i.key(), i.value())); if(container->fileName().endsWith(QStringLiteral("ddoc"), Qt::CaseInsensitive)) emit warning(UnsupportedDDocWarning); + if(container->isCades()) + emit warning(UnsupportedAsicCadesWarning); hasEmptyFile = false; for (auto i = 0; i < container->documentModel()->rowCount(); i++) diff --git a/client/widgets/WarningItem.cpp b/client/widgets/WarningItem.cpp index 1394f55e..fd15a2fd 100644 --- a/client/widgets/WarningItem.cpp +++ b/client/widgets/WarningItem.cpp @@ -134,6 +134,13 @@ void WarningItem::lookupWarning() warnText.details = tr("More information"); warnText.page = ria::qdigidoc4::SignDetails; break; + case ria::qdigidoc4::UnsupportedAsicCadesWarning: + warnText.text = tr("The current file is a ASiC container with CAdES signatures that is not supported currently. " + "You are not allowed to add or remove signatures to this container."); + warnText.url = tr("https://www.id.ee/en/article/digidoc-container-format-life-cycle-2/"); + warnText.details = tr("More information"); + warnText.page = ria::qdigidoc4::SignDetails; + break; case ria::qdigidoc4::UnsupportedDDocWarning: warnText.text = tr("The current file is a DigiDoc container that is not supported officially any longer. You are not allowed to add or remove signatures to this container."); warnText.url = tr("https://www.id.ee/en/article/digidoc-container-format-life-cycle-2/");