[git] GPGME - branch, gpgmepp, updated. gpgme-1.6.0-49-g5489532

by Andre Heinecke cvs at cvs.gnupg.org
Tue Apr 12 16:09:51 CEST 2016


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GnuPG Made Easy".

The branch, gpgmepp has been updated
       via  5489532ad6ccf3a9b59405686b8a17352f1ecf06 (commit)
       via  d949d711dc1d944a9d627d39a89af74943a5a8c1 (commit)
      from  6dba47c3a2c32d7c1e1d91a96030f99f606433ea (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit 5489532ad6ccf3a9b59405686b8a17352f1ecf06
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Tue Apr 12 16:08:10 2016 +0200

    Cpp: Add support for pubkey_algo_name
    
    * lang/cpp/src/key.cpp (Subkey::algoName): New.
    * lang/cpp/src/key.h: Declare.

diff --git a/lang/cpp/src/key.cpp b/lang/cpp/src/key.cpp
index d8b3c29..55eb058 100644
--- a/lang/cpp/src/key.cpp
+++ b/lang/cpp/src/key.cpp
@@ -383,6 +383,17 @@ const char *Subkey::publicKeyAlgorithmAsString() const
     return gpgme_pubkey_algo_name(subkey ? subkey->pubkey_algo : (gpgme_pubkey_algo_t)0);
 }
 
+std::string Subkey::algoName() const
+{
+    char *gpgmeStr;
+    if (subkey && (gpgmeStr = gpgme_pubkey_algo_string(subkey))) {
+        std::string ret = std::string(gpgmeStr);
+        gpgme_free(gpgmeStr);
+        return ret;
+    }
+    return std::string();
+}
+
 bool Subkey::canEncrypt() const
 {
     return subkey && subkey->can_encrypt;
diff --git a/lang/cpp/src/key.h b/lang/cpp/src/key.h
index 30badea..7322f65 100644
--- a/lang/cpp/src/key.h
+++ b/lang/cpp/src/key.h
@@ -206,8 +206,27 @@ public:
     bool isSecret() const;
 
     unsigned int publicKeyAlgorithm() const;
+
+    /**
+      @brief Get the public key algorithm name.
+
+      This only works for the pre 2.1 algorithms for ECC NULL is returned.
+
+      @returns a statically allocated string with the name of the public
+               key algorithm, or NULL if that name is not known.
+    */
     const char *publicKeyAlgorithmAsString() const;
 
+    /**
+       @brief Get the key algo string like GnuPG 2.1 prints it.
+
+       This returns combinations of size and algorithm. Like
+       bp512 or rsa2048
+
+       @returns the key algorithm as string. Empty string on error.
+    */
+    std::string algoName() const;
+
     unsigned int length() const;
 
     const char *cardSerialNumber() const;

commit d949d711dc1d944a9d627d39a89af74943a5a8c1
Author: Andre Heinecke <aheinecke at intevation.de>
Date:   Tue Apr 12 16:05:31 2016 +0200

    Cpp: Add support for gpgme_data_identify
    
    * lang/cpp/src/data.cpp (Data::type): New.
    * lang/cpp/src/data.h (Data::Type): New enum mapping.

diff --git a/lang/cpp/src/data.cpp b/lang/cpp/src/data.cpp
index b07406c..bf9a629 100644
--- a/lang/cpp/src/data.cpp
+++ b/lang/cpp/src/data.cpp
@@ -162,6 +162,26 @@ GpgME::Error GpgME::Data::setEncoding(Encoding enc)
     return Error(gpgme_data_set_encoding(d->data, ge));
 }
 
+GpgME::Data::Type GpgME::Data::type() const
+{
+    if (isNull()) {
+        return Invalid;
+    }
+    switch (gpgme_data_identify(d->data, 0)) {
+    case GPGME_DATA_TYPE_INVALID:       return Invalid;
+    case GPGME_DATA_TYPE_UNKNOWN:       return Unknown;
+    case GPGME_DATA_TYPE_PGP_SIGNED:    return PGPSigned;
+    case GPGME_DATA_TYPE_PGP_OTHER:     return PGPOther;
+    case GPGME_DATA_TYPE_PGP_KEY:       return PGPKey;
+    case GPGME_DATA_TYPE_CMS_SIGNED:    return CMSSigned;
+    case GPGME_DATA_TYPE_CMS_ENCRYPTED: return CMSEncrypted;
+    case GPGME_DATA_TYPE_CMS_OTHER:     return CMSOther;
+    case GPGME_DATA_TYPE_X509_CERT:     return X509Cert;
+    case GPGME_DATA_TYPE_PKCS12:        return PKCS12;
+    }
+    return Invalid;
+}
+
 char *GpgME::Data::fileName() const
 {
     return gpgme_data_get_file_name(d->data);
diff --git a/lang/cpp/src/data.h b/lang/cpp/src/data.h
index 97e4202..efb1e79 100644
--- a/lang/cpp/src/data.h
+++ b/lang/cpp/src/data.h
@@ -82,6 +82,20 @@ public:
     Encoding encoding() const;
     Error setEncoding(Encoding encoding);
 
+    enum Type {
+        Invalid,
+        Unknown,
+        PGPSigned,
+        PGPOther,
+        PGPKey,
+        CMSSigned,
+        CMSEncrypted,
+        CMSOther,
+        X509Cert,
+        PKCS12
+    };
+    Type type() const;
+
     char *fileName() const;
     Error setFileName(const char *name);
 

-----------------------------------------------------------------------

Summary of changes:
 lang/cpp/src/data.cpp | 20 ++++++++++++++++++++
 lang/cpp/src/data.h   | 14 ++++++++++++++
 lang/cpp/src/key.cpp  | 11 +++++++++++
 lang/cpp/src/key.h    | 19 +++++++++++++++++++
 4 files changed, 64 insertions(+)


hooks/post-receive
-- 
GnuPG Made Easy
http://git.gnupg.org




More information about the Gnupg-commits mailing list