...
authorvb
Tue, 05 Aug 2014 21:44:23 +0200
changeset 1598a6c1cc9160
parent 14 c99db0b8fc0f
child 16 db2b1da1ec91
...
src/pEpEngine.c
src/pEpEngine.h
     1.1 --- a/src/pEpEngine.c	Tue Aug 05 20:33:20 2014 +0200
     1.2 +++ b/src/pEpEngine.c	Tue Aug 05 21:44:23 2014 +0200
     1.3 @@ -840,16 +840,18 @@
     1.4          default:
     1.5              {
     1.6                  gpgme_decrypt_result_t gpgme_decrypt_result = _session->gpgme_op_decrypt_result(_session->ctx);
     1.7 -                result = PEP_CANNOT_DECRYPT_UNKNOWN;
     1.8 +                result = PEP_DECRYPT_NO_KEY;
     1.9  
    1.10                  if (gpgme_decrypt_result != NULL) {
    1.11 -                    *keylist = new_stringlist(gpgme_decrypt_result->unsupported_algorithm);
    1.12 +                    if (gpgme_decrypt_result->unsupported_algorithm)
    1.13 +                        *keylist = new_stringlist(gpgme_decrypt_result->unsupported_algorithm);
    1.14 +                    else
    1.15 +                        *keylist = new_stringlist("");
    1.16                      assert(*keylist);
    1.17                      if (*keylist == NULL) {
    1.18                          result = PEP_OUT_OF_MEMORY;
    1.19                          break;
    1.20                      }
    1.21 -                    
    1.22                      stringlist_t *_keylist = *keylist;
    1.23                      for (gpgme_recipient_t r = gpgme_decrypt_result->recipients; r != NULL; r = r->next) {
    1.24                          _keylist = stringlist_add(_keylist, r->keyid);
     2.1 --- a/src/pEpEngine.h	Tue Aug 05 20:33:20 2014 +0200
     2.2 +++ b/src/pEpEngine.h	Tue Aug 05 21:44:23 2014 +0200
     2.3 @@ -166,8 +166,7 @@
     2.4  //		csize (in)		size of cipher text
     2.5  //		ptext (out)		pointer to internal buffer with plain text
     2.6  //		psize (out)		size of plain text
     2.7 -//		keylist (out)	list of key ids which where used to encrypt or NULL on
     2.8 -//		                error
     2.9 +//		keylist (out)	list of key ids which where used to encrypt
    2.10  //
    2.11  //	return value:
    2.12  //		PEP_UNENCRYPTED				message was unencrypted and not signed
    2.13 @@ -182,6 +181,9 @@
    2.14  //	    the ownerships of ptext as well as keylist are going to the caller
    2.15  //	    the caller must use free() (or an Windoze pEp_free()) and
    2.16  //	    free_stringlist() to free them
    2.17 +//
    2.18 +//      if this function failes an error message may be the first element of
    2.19 +//      keylist and the other elements may be the keys used for encryption
    2.20  
    2.21  DYNAMIC_API PEP_STATUS decrypt_and_verify(
    2.22          PEP_SESSION session, const char *ctext, size_t csize,