From 8a0c8c52510d9c2d934f85159f04b666286b1786 Mon Sep 17 00:00:00 2001 From: Werner Koch Date: Thu, 17 May 2018 09:14:40 +0200 Subject: core: Always fail if an OpenPG message is not integrity protected. * src/decrypt.c (struct op_data_t): Add field not_integrity_protected. (parse_decryption_info): Set this. Also rename mode to aead_algo for clarity. (_gpgme_decrypt_status_handler): Force failure in case of a missing MDC. -- This extra check makes sure that a missing or stripped MDC in - gpg < 2.1 - or gpg 2.2 with an old cipher algorithm will lead to a decryption failure. gpg 2.3 will always fail in this case. Implementing this check here and not backporting the 2.3 change to 2.2 has the benefit that all GPGME using applications are protected but scripts relying on rfc2440 (i.e. without MDC) will only break when migrating to 2.3. Note that S/MIME has no integrity protection mechanism but gpgsm neither emits a DECRYPTION_INFO status line, so an error will not be triggered. If in the future gpgsm supports authenticated encryption it may issue a DECRYPTION_INFO line to force a failure here but it will in that case also emit a DECRYPTION_FAILED anyway. GnuPG-bug-id: 3981 Signed-off-by: Werner Koch --- NEWS | 3 +++ 1 file changed, 3 insertions(+) (limited to 'NEWS') diff --git a/NEWS b/NEWS index 80c01190..1eacccce 100644 --- a/NEWS +++ b/NEWS @@ -1,6 +1,9 @@ Noteworthy changes in version 1.11.2 (unreleased) ------------------------------------------------- + * Even for old versions of gpg a missing MDC will now lead to a + decryption failure. + Noteworthy changes in version 1.11.1 (2018-04-20) ------------------------------------------------- -- cgit From 28e3778ce21069006153bc156a414de6d9347962 Mon Sep 17 00:00:00 2001 From: Andre Heinecke Date: Tue, 22 May 2018 12:08:01 +0200 Subject: cpp: Expose sessionKey and symkeyAlgo * lang/cpp/decryptionresult.cpp, lang/cpp/decryptionresult.h (DecryptionResult::symkeyAlgo, DecryptionResult::sessionKey): New. --- NEWS | 4 ++++ lang/cpp/src/decryptionresult.cpp | 11 +++++++++++ lang/cpp/src/decryptionresult.h | 4 ++++ 3 files changed, 19 insertions(+) (limited to 'NEWS') diff --git a/NEWS b/NEWS index 1eacccce..e0adb35b 100644 --- a/NEWS +++ b/NEWS @@ -4,6 +4,10 @@ Noteworthy changes in version 1.11.2 (unreleased) * Even for old versions of gpg a missing MDC will now lead to a decryption failure. + * Interface changes relative to the 1.11.1 release: + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + cpp: DecryptionResult::sessionKey NEW. + cpp: DecryptionResult::symkeyAlgo NEW. Noteworthy changes in version 1.11.1 (2018-04-20) ------------------------------------------------- diff --git a/lang/cpp/src/decryptionresult.cpp b/lang/cpp/src/decryptionresult.cpp index 1e815cbe..17524db9 100644 --- a/lang/cpp/src/decryptionresult.cpp +++ b/lang/cpp/src/decryptionresult.cpp @@ -155,6 +155,16 @@ std::vector GpgME::DecryptionResult::recipie return result; } +const char *GpgME::DecryptionResult::sessionKey() const +{ + return d ? d->res.session_key : nullptr; +} + +const char *GpgME::DecryptionResult::symkeyAlgo() const +{ + return d ? d->res.symkey_algo : nullptr; +} + class GpgME::DecryptionResult::Recipient::Private : public _gpgme_recipient { public: @@ -231,6 +241,7 @@ std::ostream &GpgME::operator<<(std::ostream &os, const DecryptionResult &result << "\n unsupportedAlgorithm: " << protect(result.unsupportedAlgorithm()) << "\n isWrongKeyUsage: " << result.isWrongKeyUsage() << "\n isDeVs " << result.isDeVs() + << "\n symkeyAlgo: " << protect(result.symkeyAlgo()) << "\n recipients:\n"; const std::vector recipients = result.recipients(); std::copy(recipients.begin(), recipients.end(), diff --git a/lang/cpp/src/decryptionresult.h b/lang/cpp/src/decryptionresult.h index 57705b48..c270223d 100644 --- a/lang/cpp/src/decryptionresult.h +++ b/lang/cpp/src/decryptionresult.h @@ -77,6 +77,10 @@ public: const char *fileName() const; + const char *sessionKey() const; + + const char *symkeyAlgo() const; + class Recipient; unsigned int numRecipients() const; -- cgit