cpp: Expose sessionKey and symkeyAlgo
authorAndre Heinecke <aheinecke@intevation.de>
Tue, 22 May 2018 10:08:01 +0000 (12:08 +0200)
committerAndre Heinecke <aheinecke@intevation.de>
Tue, 22 May 2018 10:08:01 +0000 (12:08 +0200)
* lang/cpp/decryptionresult.cpp, lang/cpp/decryptionresult.h
(DecryptionResult::symkeyAlgo, DecryptionResult::sessionKey): New.

NEWS
lang/cpp/src/decryptionresult.cpp
lang/cpp/src/decryptionresult.h

diff --git a/NEWS b/NEWS
index 1eacccc..e0adb35 100644 (file)
--- 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)
 -------------------------------------------------
index 1e815cb..17524db 100644 (file)
@@ -155,6 +155,16 @@ std::vector<GpgME::DecryptionResult::Recipient> 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<DecryptionResult::Recipient> recipients = result.recipients();
         std::copy(recipients.begin(), recipients.end(),
index 57705b4..c270223 100644 (file)
@@ -77,6 +77,10 @@ public:
 
     const char *fileName() const;
 
+    const char *sessionKey() const;
+
+    const char *symkeyAlgo() const;
+
     class Recipient;
 
     unsigned int numRecipients() const;