cpp: Add proper gpgme_op_createkey

* lang/cpp/src/context.cpp, lang/cpp/src/context.h
(Context::createKeyEx): New.

--
The createKeyEx function follows the usual pattern that the
synchronous call returns a result directly while for the
async an extra call is neccessary.
This commit is contained in:
Andre Heinecke 2018-06-08 16:19:47 +02:00
parent 54146d90dd
commit 8dff414e17
No known key found for this signature in database
GPG Key ID: 2978E9D40CBABA5C
3 changed files with 26 additions and 0 deletions

1
NEWS
View File

@ -14,6 +14,7 @@ Noteworthy changes in version 1.11.2 (unreleased)
cpp: Data::rewind NEW. cpp: Data::rewind NEW.
cpp: Context::setFlag NEW. cpp: Context::setFlag NEW.
cpp: Context::getFlag NEW. cpp: Context::getFlag NEW.
cpp: Context::createKeyEx NEW.
Noteworthy changes in version 1.11.1 (2018-04-20) Noteworthy changes in version 1.11.1 (2018-04-20)

View File

@ -1436,6 +1436,23 @@ Error Context::createKey (const char *userid,
flags)); flags));
} }
KeyGenerationResult Context::createKeyEx (const char *userid,
const char *algo,
unsigned long reserved,
unsigned long expires,
const Key &certkey,
unsigned int flags)
{
d->lasterr = gpgme_op_createkey(d->ctx,
userid,
algo,
reserved,
expires,
certkey.impl(),
flags);
return KeyGenerationResult(d->ctx, Error(d->lasterr));
}
Error Context::addUid(const Key &k, const char *userid) Error Context::addUid(const Key &k, const char *userid)
{ {
return Error(d->lasterr = gpgme_op_adduid(d->ctx, return Error(d->lasterr = gpgme_op_adduid(d->ctx,

View File

@ -234,6 +234,14 @@ public:
const Key &certkey, const Key &certkey,
unsigned int flags); unsigned int flags);
// Same as create key but returning a result
GpgME::KeyGenerationResult createKeyEx (const char *userid,
const char *algo,
unsigned long reserved,
unsigned long expires,
const Key &certkey,
unsigned int flags);
Error addUid(const Key &key, const char *userid); Error addUid(const Key &key, const char *userid);
Error startAddUid(const Key &key, const char *userid); Error startAddUid(const Key &key, const char *userid);