Added pgp_key_revoked to pgp_gpg.*
authorEdouard Tisserant
Wed, 18 May 2016 17:52:32 +0200
changeset 6623c727b41d0c2
parent 661 ec4acbe24505
child 663 095027011e0d
Added pgp_key_revoked to pgp_gpg.*
src/pgp_gpg.c
src/pgp_gpg.h
     1.1 --- a/src/pgp_gpg.c	Wed May 18 17:05:40 2016 +0200
     1.2 +++ b/src/pgp_gpg.c	Wed May 18 17:52:32 2016 +0200
     1.3 @@ -1790,6 +1790,38 @@
     1.4      return status;
     1.5  }
     1.6  
     1.7 +PEP_STATUS pgp_key_revoked(
     1.8 +        PEP_SESSION session,
     1.9 +        const char *fpr,
    1.10 +        bool *revoked
    1.11 +    )
    1.12 +{
    1.13 +    PEP_STATUS status = PEP_STATUS_OK;
    1.14 +    gpgme_key_t key;
    1.15 +
    1.16 +    assert(session);
    1.17 +    assert(fpr);
    1.18 +    assert(revoked);
    1.19 +
    1.20 +    *expired = false;
    1.21 +
    1.22 +    status = find_single_key(session, fpr, &key);
    1.23 +    if (status != PEP_STATUS_OK)
    1.24 +        return status;
    1.25 +
    1.26 +    if (key && key->subkeys)
    1.27 +    {
    1.28 +        *expired = key->subkeys->revoked;
    1.29 +    }
    1.30 +    else
    1.31 +    {
    1.32 +        status = PEP_KEY_NOT_FOUND;
    1.33 +    }
    1.34 +
    1.35 +    gpg.gpgme_key_unref(key);
    1.36 +    return status;
    1.37 +}
    1.38 +
    1.39  PEP_STATUS pgp_binary(const char **path)
    1.40  {
    1.41      assert(path);
     2.1 --- a/src/pgp_gpg.h	Wed May 18 17:05:40 2016 +0200
     2.2 +++ b/src/pgp_gpg.h	Wed May 18 17:52:32 2016 +0200
     2.3 @@ -64,6 +64,12 @@
     2.4          bool *expired
     2.5      );
     2.6  
     2.7 +PEP_STATUS pgp_key_revoked(
     2.8 +        PEP_SESSION session,
     2.9 +        const char *fpr,
    2.10 +        bool *revoked
    2.11 +    );
    2.12 +
    2.13  PEP_STATUS pgp_binary(const char **path);
    2.14  #define PGP_BINARY_PATH pgp_binary
    2.15