aboutsummaryrefslogtreecommitdiffstats
path: root/lang/cpp/src/context.cpp
diff options
context:
space:
mode:
authorAndre Heinecke <[email protected]>2016-08-09 10:56:01 +0000
committerAndre Heinecke <[email protected]>2016-08-09 12:23:51 +0000
commitbf776ce94cf454f1b3f1645b1cde09cd1c54324b (patch)
treeeed559d7f137d3bab8d74a8b89a12dddb2870fb7 /lang/cpp/src/context.cpp
parentcore: Add support for mixed symmetric and asym enc (diff)
downloadgpgme-bf776ce94cf454f1b3f1645b1cde09cd1c54324b.tar.gz
gpgme-bf776ce94cf454f1b3f1645b1cde09cd1c54324b.zip
Cpp: Fix simple symmetric encryption
* lang/cpp/src/context.cpp (Context::encrypt): If no recipients are provided encrypt with NULL and not an empty array. -- Sending an empty array leads to an invalid argument error.
Diffstat (limited to 'lang/cpp/src/context.cpp')
-rw-r--r--lang/cpp/src/context.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/lang/cpp/src/context.cpp b/lang/cpp/src/context.cpp
index 20d827ec..814e5a82 100644
--- a/lang/cpp/src/context.cpp
+++ b/lang/cpp/src/context.cpp
@@ -1113,7 +1113,8 @@ EncryptionResult Context::encrypt(const std::vector<Key> &recipients, const Data
}
}
*keys_it++ = 0;
- d->lasterr = gpgme_op_encrypt(d->ctx, keys, encryptflags2encryptflags(flags),
+ d->lasterr = gpgme_op_encrypt(d->ctx, recipients.empty() ? nullptr : keys,
+ encryptflags2encryptflags(flags),
pdp ? pdp->data : 0, cdp ? cdp->data : 0);
delete[] keys;
return EncryptionResult(d->ctx, Error(d->lasterr));