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.
This commit is contained in:
parent
3d2f027d0f
commit
bf776ce94c
@ -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));
|
||||
|
Loading…
Reference in New Issue
Block a user