src/pgp_gpg.c
branchENGINE-74
changeset 1397 0a64816a6e37
parent 1387 cc339b22d690
child 1399 b77bc137c471
     1.1 --- a/src/pgp_gpg.c	Mon Nov 14 13:32:35 2016 +0100
     1.2 +++ b/src/pgp_gpg.c	Tue Nov 15 18:16:58 2016 +0100
     1.3 @@ -384,6 +384,7 @@
     1.4  
     1.5  PEP_STATUS pgp_decrypt_and_verify(
     1.6      PEP_SESSION session, const char *ctext, size_t csize,
     1.7 +    const char *dsigtext, size_t dsigsize,
     1.8      char **ptext, size_t *psize, stringlist_t **keylist
     1.9      )
    1.10  {
    1.11 @@ -464,11 +465,29 @@
    1.12                  reading = gpg.gpgme_data_read(plain, _buffer, length);
    1.13                  assert(length == reading);
    1.14  
    1.15 +//                 if (detached_sig) {  // Is this safe to do?
    1.16 +//                     gpgme_data_t sigdata;
    1.17 +//                     gpg.gpgme_data_new_from_mem(&sigdata, detached_sig->value,
    1.18 +//                                                 detached_sig->size, 0);
    1.19 +//                     gpgme_op_verify(session->ctx, sigdata, plain, NULL);
    1.20 +//                 }
    1.21 +                
    1.22                  gpgme_verify_result =
    1.23                      gpg.gpgme_op_verify_result(session->ctx);
    1.24                  assert(gpgme_verify_result);
    1.25                  gpgme_signature = gpgme_verify_result->signatures;
    1.26  
    1.27 +                if (!gpgme_signature && dsigtext) {
    1.28 +                    gpgme_data_t sigdata;
    1.29 +                    gpg.gpgme_data_new_from_mem(&sigdata, dsigtext,
    1.30 +                                                dsigsize, 0);
    1.31 +                    gpgme_op_verify(session->ctx, sigdata, plain, NULL);
    1.32 +                    gpgme_verify_result =
    1.33 +                        gpg.gpgme_op_verify_result(session->ctx);
    1.34 +                    assert(gpgme_verify_result);
    1.35 +                    gpgme_signature = gpgme_verify_result->signatures;
    1.36 +                }
    1.37 +                
    1.38                  if (gpgme_signature) {
    1.39                      stringlist_t *k;
    1.40                      _keylist = new_stringlist(NULL);