[Pkg-gnupg-commit] [gpgme] 204/412: Cpp: Expose gpgme_pubkey_algo_name

Daniel Kahn Gillmor dkg at fifthhorseman.net
Thu Sep 22 21:26:47 UTC 2016


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

dkg pushed a commit to branch master
in repository gpgme.

commit e41ae4db9e70d9aebf80ebbd4ce03977435c2ccf
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Wed Jul 6 15:07:34 2016 +0200

    Cpp: Expose gpgme_pubkey_algo_name
    
    * lang/cpp/src/key.cpp (Subkey::publicKeyAlgorithmAsString): New
    static variant.
    * lang/cpp/src/key.h: Declare function. Clarify comment about name
    mismatch.
---
 lang/cpp/src/key.cpp | 9 +++++++++
 lang/cpp/src/key.h   | 7 ++++++-
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/lang/cpp/src/key.cpp b/lang/cpp/src/key.cpp
index 9e57013..d99c5ec 100644
--- a/lang/cpp/src/key.cpp
+++ b/lang/cpp/src/key.cpp
@@ -383,6 +383,15 @@ const char *Subkey::publicKeyAlgorithmAsString() const
     return gpgme_pubkey_algo_name(subkey ? subkey->pubkey_algo : (gpgme_pubkey_algo_t)0);
 }
 
+/* static */
+const char *Subkey::publicKeyAlgorithmAsString(PubkeyAlgo algo)
+{
+    if (algo == AlgoUnknown) {
+        return NULL;
+    }
+    return gpgme_pubkey_algo_name(static_cast<gpgme_pubkey_algo_t>(algo));
+}
+
 std::string Subkey::algoName() const
 {
     char *gpgmeStr;
diff --git a/lang/cpp/src/key.h b/lang/cpp/src/key.h
index 845b5db..bb0487b 100644
--- a/lang/cpp/src/key.h
+++ b/lang/cpp/src/key.h
@@ -233,11 +233,16 @@ public:
     */
     const char *publicKeyAlgorithmAsString() const;
 
+    /** @brief Same as publicKeyAlgorithmAsString but static. */
+    static const char *publicKeyAlgorithmAsString(PubkeyAlgo algo);
+
     /**
        @brief Get the key algo string like GnuPG 2.1 prints it.
 
        This returns combinations of size and algorithm. Like
-       bp512 or rsa2048
+       bp512 or rsa2048. Misnamed because publicKeyAlgorithmAsString
+       already used the older pubkey_algo_name.
+       Actually uses gpgme_pubkey_algo_string.
 
        @returns the key algorithm as string. Empty string on error.
     */

-- 
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