diff options
author | Andre Heinecke <[email protected]> | 2016-08-09 10:56:01 +0000 |
---|---|---|
committer | Andre Heinecke <[email protected]> | 2016-08-09 12:23:51 +0000 |
commit | bf776ce94cf454f1b3f1645b1cde09cd1c54324b (patch) | |
tree | eed559d7f137d3bab8d74a8b89a12dddb2870fb7 /lang/cpp/src/context.cpp | |
parent | core: Add support for mixed symmetric and asym enc (diff) | |
download | gpgme-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.cpp | 3 |
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)); |