diff options
Diffstat (limited to 'lang/cpp')
| -rw-r--r-- | lang/cpp/src/key.cpp | 31 | ||||
| -rw-r--r-- | lang/cpp/src/key.h | 21 | 
2 files changed, 52 insertions, 0 deletions
| diff --git a/lang/cpp/src/key.cpp b/lang/cpp/src/key.cpp index 0e86a19e..838033c5 100644 --- a/lang/cpp/src/key.cpp +++ b/lang/cpp/src/key.cpp @@ -981,6 +981,37 @@ Error Key::addUid(const char *uid)      return ret;  } +Key::Origin Key::origin() const +{ +    if (isNull()) { +        return OriginUnknown; +    } +    switch (key->origin) { +        case GPGME_KEYORG_KS: +            return OriginKS; +        case GPGME_KEYORG_DANE: +            return OriginDane; +        case GPGME_KEYORG_WKD: +            return OriginWKD; +        case GPGME_KEYORG_URL: +            return OriginURL; +        case GPGME_KEYORG_FILE: +            return OriginFile; +        case GPGME_KEYORG_SELF: +            return OriginSelf; +        case GPGME_KEYORG_OTHER: +            return OriginOther; +        case GPGME_KEYORG_UNKNOWN: +        default: +            return OriginUnknown; +    } +} + +time_t Key::lastUpdate() const +{ +    return static_cast<time_t>(key ? key->last_update : 0); +} +  std::ostream &operator<<(std::ostream &os, const UserID &uid)  {      os << "GpgME::UserID("; diff --git a/lang/cpp/src/key.h b/lang/cpp/src/key.h index c3c711c1..07ddc256 100644 --- a/lang/cpp/src/key.h +++ b/lang/cpp/src/key.h @@ -178,6 +178,27 @@ public:       */      static Key locate(const char *mbox); +    /* @enum Origin +     * @brief The Origin of the key. */ +    enum Origin : unsigned int { +        OriginUnknown = 0, +        OriginKS = 1, +        OriginDane = 3, +        OriginWKD = 4, +        OriginURL = 5, +        OriginFile = 6, +        OriginSelf = 7, +        OriginOther = 31, +    }; +    /*! Get the origin of the key. +     * +     * @returns the Origin. */ +    Origin origin() const; + +    /*! Get the last update time. +     * +     * @returns the last update time. */ +    time_t lastUpdate() const;  private:      gpgme_key_t impl() const      { | 
