Changeset View
Changeset View
Standalone View
Standalone View
src/crypto/decryptverifytask.cpp
Show First 20 Lines • Show All 47 Lines • ▼ Show 20 Line(s) | |||||
48 | #include <Libkleo/Formatting> | 48 | #include <Libkleo/Formatting> | ||
49 | #include <Libkleo/Classify> | 49 | #include <Libkleo/Classify> | ||
50 | 50 | | |||
51 | #include <utils/detail_p.h> | 51 | #include <utils/detail_p.h> | ||
52 | #include <utils/input.h> | 52 | #include <utils/input.h> | ||
53 | #include <utils/output.h> | 53 | #include <utils/output.h> | ||
54 | #include <utils/kleo_assert.h> | 54 | #include <utils/kleo_assert.h> | ||
55 | #include <utils/auditlog.h> | 55 | #include <utils/auditlog.h> | ||
56 | #include <utils/gnupg-helper.h> | ||||
56 | 57 | | |||
57 | #include <kmime/kmime_header_parsing.h> | 58 | #include <kmime/kmime_header_parsing.h> | ||
58 | 59 | | |||
59 | #include <gpgme++/error.h> | 60 | #include <gpgme++/error.h> | ||
60 | #include <gpgme++/key.h> | 61 | #include <gpgme++/key.h> | ||
61 | #include <gpgme++/verificationresult.h> | 62 | #include <gpgme++/verificationresult.h> | ||
62 | #include <gpgme++/decryptionresult.h> | 63 | #include <gpgme++/decryptionresult.h> | ||
63 | 64 | | |||
▲ Show 20 Lines • Show All 225 Lines • ▼ Show 20 Line(s) | 285 | { | |||
289 | QString text; | 290 | QString text; | ||
290 | Key key = sig.key(); | 291 | Key key = sig.key(); | ||
291 | if (dt.isValid()) { | 292 | if (dt.isValid()) { | ||
292 | text = i18nc("1 is a date", "Signature created on %1", formatDate(dt)) + QStringLiteral("<br>"); | 293 | text = i18nc("1 is a date", "Signature created on %1", formatDate(dt)) + QStringLiteral("<br>"); | ||
293 | } | 294 | } | ||
294 | if (key.isNull()) { | 295 | if (key.isNull()) { | ||
295 | return text += i18n("With unavailable certificate:") + QStringLiteral("<br>ID: 0x%1").arg(QString::fromLatin1(sig.fingerprint()).toUpper()); | 296 | return text += i18n("With unavailable certificate:") + QStringLiteral("<br>ID: 0x%1").arg(QString::fromLatin1(sig.fingerprint()).toUpper()); | ||
296 | } | 297 | } | ||
297 | return text += i18n("With certificate:") + QStringLiteral("<br>") + renderKey(key); | 298 | text += i18n("With certificate:") + QStringLiteral("<br>") + renderKey(key); | ||
299 | | ||||
300 | if (Kleo::gpgComplianceP("de-vs")) | ||||
301 | text += | ||||
302 | (QStringLiteral("<br/>") | ||||
303 | + (IS_DE_VS(sig) | ||||
304 | ? i18nc("VS-conforming is a German standard for restricted documents for which special restrictions about algorithms apply. The string states that a signature is compliant with that.", | ||||
305 | "The signature is VS-compliant.") | ||||
306 | : i18nc("VS-conforming is a German standard for restricted documents for which special restrictions about algorithms apply. The string states that a signature is not compliant with that.", | ||||
307 | "The signature <b>is not</b> VS-compliant."))); | ||||
308 | | ||||
309 | return text; | ||||
298 | } | 310 | } | ||
299 | 311 | | |||
300 | static QString strikeOut(const QString &str, bool strike) | 312 | static QString strikeOut(const QString &str, bool strike) | ||
301 | { | 313 | { | ||
302 | return QString(strike ? QStringLiteral("<s>%1</s>") : QStringLiteral("%1")).arg(str.toHtmlEscaped()); | 314 | return QString(strike ? QStringLiteral("<s>%1</s>") : QStringLiteral("%1")).arg(str.toHtmlEscaped()); | ||
303 | } | 315 | } | ||
304 | 316 | | |||
305 | static QString formatInputOutputLabel(const QString &input, const QString &output, bool inputDeleted, bool outputDeleted) | 317 | static QString formatInputOutputLabel(const QString &input, const QString &output, bool inputDeleted, bool outputDeleted) | ||
▲ Show 20 Lines • Show All 220 Lines • ▼ Show 20 Line(s) | 526 | { | |||
526 | if (info.conflicts()) { | 538 | if (info.conflicts()) { | ||
527 | details += i18n("<p>The sender's address %1 is not stored in the certificate. Stored: %2</p>", info.informativeSender.prettyAddress(), format(info.signerMailboxes()).join(i18nc("separator for a list of e-mail addresses", ", "))); | 539 | details += i18n("<p>The sender's address %1 is not stored in the certificate. Stored: %2</p>", info.informativeSender.prettyAddress(), format(info.signerMailboxes()).join(i18nc("separator for a list of e-mail addresses", ", "))); | ||
528 | } | 540 | } | ||
529 | return details; | 541 | return details; | ||
530 | } | 542 | } | ||
531 | 543 | | |||
532 | static QString formatDecryptionResultDetails(const DecryptionResult &res, const std::vector<Key> &recipients, const QString &errorString, bool isSigned) | 544 | static QString formatDecryptionResultDetails(const DecryptionResult &res, const std::vector<Key> &recipients, const QString &errorString, bool isSigned) | ||
533 | { | 545 | { | ||
546 | QString details; | ||||
547 | | ||||
534 | if ((res.error().code() == GPG_ERR_EIO || res.error().code() == GPG_ERR_NO_DATA) && !errorString.isEmpty()) { | 548 | if ((res.error().code() == GPG_ERR_EIO || res.error().code() == GPG_ERR_NO_DATA) && !errorString.isEmpty()) { | ||
535 | return i18n("Input error: %1", errorString); | 549 | return i18n("Input error: %1", errorString); | ||
536 | } | 550 | } | ||
537 | 551 | | |||
552 | if (Kleo::gpgComplianceP("de-vs")) | ||||
553 | details += ((IS_DE_VS(res) | ||||
554 | ? i18nc("VS-conforming is a German standard for restricted documents for which special restrictions about algorithms apply. The string states that the decryption is compliant with that.", | ||||
555 | "The decryption is VS-compliant.") | ||||
556 | : i18nc("VS-conforming is a German standard for restricted documents for which special restrictions about algorithms apply. The string states that the decryption is compliant with that.", | ||||
557 | "The decryption <b>is not</b> VS-compliant.")) | ||||
558 | + QStringLiteral("<br/>")); | ||||
559 | | ||||
538 | if (res.isNull() || !res.error() || res.error().isCanceled()) { | 560 | if (res.isNull() || !res.error() || res.error().isCanceled()) { | ||
539 | if (!isSigned) { | 561 | if (!isSigned) { | ||
540 | return i18n("<b>Note:</b> You cannot be sure who encrypted this message as it is not signed."); | 562 | return details + i18n("<b>Note:</b> You cannot be sure who encrypted this message as it is not signed."); | ||
541 | } | 563 | } | ||
542 | return QString(); | 564 | return details; | ||
543 | } | 565 | } | ||
544 | 566 | | |||
545 | if (recipients.empty() && res.numRecipients() > 0) { | 567 | if (recipients.empty() && res.numRecipients() > 0) { | ||
546 | return QLatin1String("<i>") + i18np("One unknown recipient.", "%1 unknown recipients.", res.numRecipients()) + QLatin1String("</i>"); | 568 | return details + QLatin1String("<i>") + i18np("One unknown recipient.", "%1 unknown recipients.", res.numRecipients()) + QLatin1String("</i>"); | ||
547 | } | 569 | } | ||
548 | 570 | | |||
549 | QString details; | | |||
550 | if (!recipients.empty()) { | 571 | if (!recipients.empty()) { | ||
551 | details += i18np("Recipient:", "Recipients:", res.numRecipients()); | 572 | details += i18np("Recipient:", "Recipients:", res.numRecipients()); | ||
552 | if (res.numRecipients() == 1) { | 573 | if (res.numRecipients() == 1) { | ||
553 | return details + renderKey(recipients.front()); | 574 | return details + renderKey(recipients.front()); | ||
554 | } | 575 | } | ||
555 | 576 | | |||
556 | details += QLatin1String("<ul>"); | 577 | details += QLatin1String("<ul>"); | ||
557 | for (const Key &key : recipients) { | 578 | for (const Key &key : recipients) { | ||
▲ Show 20 Lines • Show All 966 Lines • Show Last 20 Lines |