[GPGME] Repeated decrypt fails

Werner Koch wk at gnupg.org
Fri May 18 11:58:16 CEST 2018

On Thu, 17 May 2018 20:48, trinh.randy at gmail.com said:

> err = gpgme_op_decrypt_start(ctx, fileEncrypted, fileDecrypted);
> ctx = gpgme_wait(ctx, &stat, 1);
> std::cout << "Decrypt Status: " << gpgme_strerror(err) << std::endl;

Here you show the result of the start operation which is usuallay
success.  What you need to check here instead is STAT as returned by

Is there a reason why you use the asynchronous operaions and not the
synchronous?  Your code would not work with multiple threads because
gpgme_wait may only be called by one thread.

> The version of GPG I am using is 2.0.22 (or 1.4.16) I have both installed

gpgme has a function to figure this out:

  /* Get the information about the configured engines.  A pointer to the
   * first engine in the statically allocated linked list is returned.
   * The returned data is valid until the next gpgme_ctx_set_engine_info.  */
  gpgme_engine_info_t gpgme_ctx_get_engine_info (gpgme_ctx_t ctx);
or you run your program with

  GPGME_DEBUG=1:gpgme.log: ./test

which prints the full name of the used tools.  Call them then with
option --version.



#  Please read:  Daniel Ellsberg - The Doomsday Machine  #
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 227 bytes
Desc: not available
URL: <https://lists.gnupg.org/pipermail/gnupg-users/attachments/20180518/0012d4a2/attachment.sig>

More information about the Gnupg-users mailing list