aboutsummaryrefslogtreecommitdiffstats
path: root/lang/cpp/src/key.cpp
diff options
context:
space:
mode:
authorAndre Heinecke <[email protected]>2016-07-06 13:07:34 +0000
committerAndre Heinecke <[email protected]>2016-07-06 13:07:34 +0000
commite41ae4db9e70d9aebf80ebbd4ce03977435c2ccf (patch)
tree2f3c2131a0386644fcc1db8028d3b479d07fcbd3 /lang/cpp/src/key.cpp
parentQt: Add check for pubkeyAlgo in t-keylist (diff)
downloadgpgme-e41ae4db9e70d9aebf80ebbd4ce03977435c2ccf.tar.gz
gpgme-e41ae4db9e70d9aebf80ebbd4ce03977435c2ccf.zip
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.
Diffstat (limited to 'lang/cpp/src/key.cpp')
-rw-r--r--lang/cpp/src/key.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/lang/cpp/src/key.cpp b/lang/cpp/src/key.cpp
index 9e57013a..d99c5ec9 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;