diff options
Diffstat (limited to 'lang/cpp')
| -rw-r--r-- | lang/cpp/src/key.cpp | 9 | ||||
| -rw-r--r-- | lang/cpp/src/key.h | 5 | ||||
| -rw-r--r-- | lang/cpp/src/tofuinfo.cpp | 30 | ||||
| -rw-r--r-- | lang/cpp/src/tofuinfo.h | 11 | ||||
| -rw-r--r-- | lang/cpp/src/verificationresult.cpp | 19 | ||||
| -rw-r--r-- | lang/cpp/src/verificationresult.h | 13 | 
6 files changed, 15 insertions, 72 deletions
diff --git a/lang/cpp/src/key.cpp b/lang/cpp/src/key.cpp index d99c5ec9..68d7685f 100644 --- a/lang/cpp/src/key.cpp +++ b/lang/cpp/src/key.cpp @@ -23,6 +23,7 @@  #include <key.h>  #include "util.h" +#include "tofuinfo.h"  #include <gpgme.h> @@ -625,6 +626,14 @@ bool UserID::isInvalid() const      return uid && uid->invalid;  } +TofuInfo UserID::tofuInfo() const +{ +    if (!uid) { +        return TofuInfo(); +    } +    return TofuInfo(uid->tofu); +} +  //  //  // class Signature diff --git a/lang/cpp/src/key.h b/lang/cpp/src/key.h index bb0487b9..e8d7ee23 100644 --- a/lang/cpp/src/key.h +++ b/lang/cpp/src/key.h @@ -43,6 +43,7 @@ class Context;  class Subkey;  class UserID; +class TofuInfo;  typedef std::shared_ptr< std::remove_pointer<gpgme_key_t>::type > shared_gpgme_key_t; @@ -309,6 +310,10 @@ public:      bool isRevoked() const;      bool isInvalid() const; +    /** TOFU info for this userid. +     * @returns The TOFU stats or a null TofuInfo. +     */ +    GpgME::TofuInfo tofuInfo() const;  private:      shared_gpgme_key_t key;      gpgme_user_id_t uid; diff --git a/lang/cpp/src/tofuinfo.cpp b/lang/cpp/src/tofuinfo.cpp index c27a59ed..fe8f051f 100644 --- a/lang/cpp/src/tofuinfo.cpp +++ b/lang/cpp/src/tofuinfo.cpp @@ -31,12 +31,6 @@ public:      Private(gpgme_tofu_info_t info)          : mInfo(info ? new _gpgme_tofu_info(*info) : nullptr)      { -        if (mInfo && mInfo->fpr) { -            mInfo->fpr = strdup(mInfo->fpr); -        } -        if (mInfo && mInfo->address) { -            mInfo->address = strdup(mInfo->address); -        }          if (mInfo && mInfo->description) {              mInfo->description = strdup(mInfo->description);          } @@ -45,12 +39,6 @@ public:      Private(const Private &other)          : mInfo(other.mInfo)      { -        if (mInfo && mInfo->fpr) { -            mInfo->fpr = strdup(mInfo->fpr); -        } -        if (mInfo && mInfo->address) { -            mInfo->address = strdup(mInfo->address); -        }          if (mInfo && mInfo->description) {              mInfo->description = strdup(mInfo->description);          } @@ -59,10 +47,6 @@ public:      ~Private()      {          if (mInfo) { -            std::free(mInfo->fpr); -            mInfo->fpr = nullptr; -            std::free(mInfo->address); -            mInfo->address = nullptr;              std::free(mInfo->description);              mInfo->description = nullptr; @@ -129,16 +113,6 @@ GpgME::TofuInfo::Policy GpgME::TofuInfo::policy() const      }  } -const char *GpgME::TofuInfo::fingerprint() const -{ -    return isNull() ? nullptr : d->mInfo->fpr; -} - -const char *GpgME::TofuInfo::address() const -{ -    return isNull() ? nullptr : d->mInfo->address; -} -  const char *GpgME::TofuInfo::description() const  {      return isNull() ? nullptr : d->mInfo->description; @@ -163,9 +137,7 @@ std::ostream &GpgME::operator<<(std::ostream &os, const GpgME::TofuInfo &info)  {      os << "GpgME::Signature::TofuInfo(";      if (!info.isNull()) { -        os << "\n address:  " << protect(info.address()) -           << "\n fpr: "      << protect(info.fingerprint()) -           << "\n desc: "     << protect(info.description()) +        os << "\n desc: "     << protect(info.description())             << "\n validity: " << info.validity()             << "\n policy: "   << info.policy()             << "\n signcount: "<< info.signCount() diff --git a/lang/cpp/src/tofuinfo.h b/lang/cpp/src/tofuinfo.h index c698360f..48351205 100644 --- a/lang/cpp/src/tofuinfo.h +++ b/lang/cpp/src/tofuinfo.h @@ -99,20 +99,9 @@ public:      /* Number of seconds since the last message was verified. */      unsigned int lastSeen() const; -    /* Finterprint of the key for this entry. */ -    const char *fingerprint() const; -      /* If non-NULL a human readable string summarizing the TOFU data. */      const char *description() const; -    /* The address of the tofu binding. -     * -     * If no mail address is set for a User ID this is the name used -     * for the user ID. Can be ambiguous when the same mail address or -     * name is used in multiple user ids. -     */ -    const char *address() const; -  private:      class Private;      std::shared_ptr<Private> d; diff --git a/lang/cpp/src/verificationresult.cpp b/lang/cpp/src/verificationresult.cpp index 3eb8a850..c32c8964 100644 --- a/lang/cpp/src/verificationresult.cpp +++ b/lang/cpp/src/verificationresult.cpp @@ -24,7 +24,6 @@  #include <notation.h>  #include "result_p.h"  #include "util.h" -#include "tofuinfo.h"  #include <gpgme.h> @@ -82,11 +81,6 @@ public:                  }                  nota.back().push_back(n);              } -            // copy tofu info: -            tinfos.push_back(std::vector<TofuInfo>()); -            for (gpgme_tofu_info_t in = is->tofu; in ; in = in->next) { -                tinfos.back().push_back(TofuInfo(in)); -            }          }      }      ~Private() @@ -113,7 +107,6 @@ public:      std::vector<gpgme_signature_t> sigs;      std::vector< std::vector<Nota> > nota; -    std::vector< std::vector<TofuInfo> > tinfos;      std::vector<char *> purls;      std::string file_name;  }; @@ -373,15 +366,6 @@ std::vector<GpgME::Notation> GpgME::Signature::notations() const      return result;  } -std::vector<GpgME::TofuInfo> GpgME::Signature::tofuInfo() const -{ -    if (isNull()) { -        return std::vector<GpgME::TofuInfo>(); -    } - -    return d->tinfos[idx]; -} -  class GpgME::Notation::Private  {  public: @@ -550,9 +534,6 @@ std::ostream &GpgME::operator<<(std::ostream &os, const Signature &sig)          const std::vector<Notation> nota = sig.notations();          std::copy(nota.begin(), nota.end(),                    std::ostream_iterator<Notation>(os, "\n")); -        const std::vector<TofuInfo> tinfos = sig.tofuInfo(); -        std::copy(tinfos.begin(), tinfos.end(), -                  std::ostream_iterator<TofuInfo>(os, "\n"));      }      return os << ')';  } diff --git a/lang/cpp/src/verificationresult.h b/lang/cpp/src/verificationresult.h index f5fbc2ec..3394a474 100644 --- a/lang/cpp/src/verificationresult.h +++ b/lang/cpp/src/verificationresult.h @@ -40,7 +40,6 @@ namespace GpgME  class Error;  class Signature;  class Notation; -class TofuInfo;  class GPGMEPP_EXPORT VerificationResult : public Result  { @@ -158,18 +157,6 @@ public:      GpgME::Notation notation(unsigned int index) const;      std::vector<GpgME::Notation> notations() const; -    /** List of TOFU stats for this signature. -     * -     * For each UserID of the key used to create this -     * signature a tofu entry is returned. -     * -     * Warning: Addresses can be ambigous if there are multiple UserID's -     * with the same mailbox in a key. -     * -     * @returns The list of TOFU stats. -     */ -    std::vector<GpgME::TofuInfo> tofuInfo() const; -  private:      std::shared_ptr<VerificationResult::Private> d;      unsigned int idx;  | 
