[Pkg-gnupg-commit] [gpgme] 84/103: cpp: Wrap create_key and create_subkey

Daniel Kahn Gillmor dkg at fifthhorseman.net
Thu Dec 14 18:53:07 UTC 2017


This is an automated email from the git hooks/post-receive script.

dkg pushed a commit to branch master
in repository gpgme.

commit 8e2d6c28a5e923f829b5a26d19d9d897949aa1fe
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Fri Dec 1 13:21:34 2017 +0100

    cpp: Wrap create_key and create_subkey
    
    * lang/cpp/src/context.cpp,
    lang/cpp/src/context.h (Context::startCreateKey)
    (Context::createKey, Context::createSubkey)
    (Context::startCreateSubkey): New.
---
 NEWS                     |  4 ++++
 lang/cpp/src/context.cpp | 50 ++++++++++++++++++++++++++++++++++++++++++++++++
 lang/cpp/src/context.h   | 26 +++++++++++++++++++++++++
 3 files changed, 80 insertions(+)

diff --git a/NEWS b/NEWS
index aee3f10..83c8f5f 100644
--- a/NEWS
+++ b/NEWS
@@ -15,6 +15,10 @@ Noteworthy changes in version 1.10.0 (unreleased)
  cpp: DecryptionResult::isDeVs         NEW.
  cpp: Signature::isDeVs                NEW.
  cpp: EngineInfo::Version::operator>   NEW.
+ cpp: Context::createKey               NEW.
+ cpp: Context::startCreateKey          NEW.
+ cpp: Context::createSubkey            NEW.
+ cpp: Context::startCreateSubkey       NEW.
  py: DecryptResult           EXTENDED: New boolean field 'is_de_vs'.
  py: Signature               EXTENDED: New boolean field 'is_de_vs'.
  py: GpgError                EXTENDED: Partial results in 'results'.
diff --git a/lang/cpp/src/context.cpp b/lang/cpp/src/context.cpp
index 77962d8..135e4d5 100644
--- a/lang/cpp/src/context.cpp
+++ b/lang/cpp/src/context.cpp
@@ -1404,6 +1404,38 @@ Error Context::setTofuPolicyStart(const Key &k, unsigned int policy)
                  k.impl(), to_tofu_policy_t(policy)));
 }
 
+Error Context::startCreateKey (const char *userid,
+                               const char *algo,
+                               unsigned long reserved,
+                               unsigned long expires,
+                               const Key &certkey,
+                               unsigned int flags)
+{
+    return Error(d->lasterr = gpgme_op_createkey_start(d->ctx,
+                 userid,
+                 algo,
+                 reserved,
+                 expires,
+                 certkey.impl(),
+                 flags));
+}
+
+Error Context::createKey (const char *userid,
+                          const char *algo,
+                          unsigned long reserved,
+                          unsigned long expires,
+                          const Key &certkey,
+                          unsigned int flags)
+{
+    return Error(d->lasterr = gpgme_op_createkey(d->ctx,
+                 userid,
+                 algo,
+                 reserved,
+                 expires,
+                 certkey.impl(),
+                 flags));
+}
+
 Error Context::addUid(const Key &k, const char *userid)
 {
     return Error(d->lasterr = gpgme_op_adduid(d->ctx,
@@ -1428,6 +1460,24 @@ Error Context::startRevUid(const Key &k, const char *userid)
                  k.impl(), userid, 0));
 }
 
+Error Context::createSubkey(const Key &k, const char *algo,
+                            unsigned long reserved,
+                            unsigned long expires,
+                            unsigned int flags)
+{
+    return Error(d->lasterr = gpgme_op_createsubkey(d->ctx,
+                 k.impl(), algo, reserved, expires, flags));
+}
+
+Error Context::startCreateSubkey(const Key &k, const char *algo,
+                                 unsigned long reserved,
+                                 unsigned long expires,
+                                 unsigned int flags)
+{
+    return Error(d->lasterr = gpgme_op_createsubkey_start(d->ctx,
+                 k.impl(), algo, reserved, expires, flags));
+}
+
 // Engine Spawn stuff
 Error Context::spawn(const char *file, const char *argv[],
                      Data &input, Data &output, Data &err,
diff --git a/lang/cpp/src/context.h b/lang/cpp/src/context.h
index bec4e39..4cd5b30 100644
--- a/lang/cpp/src/context.h
+++ b/lang/cpp/src/context.h
@@ -214,12 +214,38 @@ public:
     GpgME::Error edit(const Key &key, std::unique_ptr<EditInteractor> function, Data &out);
     GpgME::Error startEditing(const Key &key, std::unique_ptr<EditInteractor> function, Data &out);
 
+
+    //
+    // Modern Interface actions. Require 2.1.x
+    //
+    Error startCreateKey (const char *userid,
+                          const char *algo,
+                          unsigned long reserved,
+                          unsigned long expires,
+                          const Key &certkey,
+                          unsigned int flags);
+    Error createKey (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 startAddUid(const Key &key, const char *userid);
 
     Error revUid(const Key &key, const char *userid);
     Error startRevUid(const Key &key, const char *userid);
 
+    Error createSubkey(const Key &key, const char *algo,
+                       unsigned long reserved = 0,
+                       unsigned long expires = 0,
+                       unsigned int flags = 0);
+    Error startCreateSubkey(const Key &key, const char *algo,
+                            unsigned long reserved = 0,
+                            unsigned long expires = 0,
+                            unsigned int flags = 0);
+
     // using TofuInfo::Policy
     Error setTofuPolicy(const Key &k, unsigned int policy);
     Error setTofuPolicyStart(const Key &k, unsigned int policy);

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-gnupg/gpgme.git



More information about the Pkg-gnupg-commit mailing list