Page MenuHome GnuPG

gpgmeProject
ActivePublic

Milestones

Details

Description

GnuPG Made Easy (GPGME) is a C language library that allows to add support for cryptography to a program. It is designed to make access to public key crypto engines like GnuPG or GpgSM easier for applications. GPGME provides a high-level crypto API for encryption, decryption, signing, signature verification and key management.

GPGME comes with language bindings for Common Lisp, C++, QT, Python2 and Python 3.

GPGME uses GnuPG and GpgSM as its backends to support OpenPGP and the Cryptographic Message Syntax (CMS).

Recent Activity

Mon, Sep 1

gniibe added a comment to T7759: Kleopatra: Notepad encryption with S/MIME fails.

I fixed the problem (which I identified above) in gniibe/t7759 branch. There might be other causes/problems for the particular symptom, so, I don't know the fix resolves the symptom or not.

Mon, Sep 1, 4:16 AM · gnupg26, gpgme, kleopatra, gpd5x

Wed, Aug 27

werner moved T7759: Kleopatra: Notepad encryption with S/MIME fails from Backlog to WIP on the gnupg26 board.
Wed, Aug 27, 10:34 AM · gnupg26, gpgme, kleopatra, gpd5x
gniibe added a comment to T7759: Kleopatra: Notepad encryption with S/MIME fails.

Similar situation could happen with gpgsm + gpg-agent, when gpg-agent is invoked by gpgsm.
(1) No gpg-agent.
(2) In gpgme, by engine-gpgsm, gpgsm is invoked with --logger.
(3) In gpgsm_keylist, it makes sure gpg-agent is available by GETINFO agent-check, using gpgsm_assuan_simple_command.
(4) In the server side, it tries to connect gpg-agent, invokes gpg-agent, and connect to the agent again.
(5) On Windows, it may takes time to invoke gpg-agent. And it may try to connect multiple times. Each trial may generate debug messages.
(6) When it takes too much time, the debug messages are too much. It may fill the pipe.
(7) And it blocks at log_string in my_libassuan_log_handler.
(8) ... it hangs.

Wed, Aug 27, 6:53 AM · gnupg26, gpgme, kleopatra, gpd5x
gniibe added a comment to T7759: Kleopatra: Notepad encryption with S/MIME fails.

Hypothetical scenario (gpgsm --server + dirmngr):
(0) It may hang when much debug messages are generated by libassuan to the pipe of --logger (diag_cb).
(1) In gpgme, by engine-gpgsm, gpgsm is invoked with --logger.
(2) If it's the case of standard gpgme interactions which uses gpgsm_io_event, no problem. Because the data on diag_cb is consumed well.
(3) In case of gpgsm_encrypt (or other commands), it uses gpgsm_assuan_simple_command which does not consume the data on diag_cb pipe at all.
(4) In particular, in set_recipients, gpgsm_assuan_simple_command is called by the number of recipients.
(5) IIUC, in the server side, dirmngr is used by the call chain of:

  • gpgsm_add_to_certlist
  • gpgsm_validate_chain...
  • gpgsm_dirmngr_isvalid

(6) In gpgsm_dirmngr_isvalid function, libassuan is used as client side, it generates debug messages.
(7) When there are many recipients, the debug message may be big enough to fill the pipe.
(8) When pipe is filled, it blocks by log_string in my_libassuan_log_handler, waiting the data in pipe is consumed.
(9) ... it hangs.

Wed, Aug 27, 5:12 AM · gnupg26, gpgme, kleopatra, gpd5x

Wed, Aug 13

ebo updated the task description for T7755: Kleopatra: Show error if a certification did not succeed, even if the cause is crash of background process.
Wed, Aug 13, 2:40 PM · gnupg, gpgme, gpd5x, kleopatra
ebo triaged T7755: Kleopatra: Show error if a certification did not succeed, even if the cause is crash of background process as Low priority.

We decided that gpg should emit a status message for success, too.
gpgme should then look for that status message instead of only absence of error.

Wed, Aug 13, 2:35 PM · gnupg, gpgme, gpd5x, kleopatra
ebo closed T6694: Random numbers from gpgme as Resolved.
Wed, Aug 13, 11:14 AM · gpd5x, gpgpass, gpgme, Feature Request
werner added a comment to T7759: Kleopatra: Notepad encryption with S/MIME fails.

A quick check with passing ASSUAN_PIPE_CONNECT_DETACHED does not changed anything.

Wed, Aug 13, 9:54 AM · gnupg26, gpgme, kleopatra, gpd5x

Tue, Aug 12

werner added a comment to T7759: Kleopatra: Notepad encryption with S/MIME fails.

I wonder whether rA3bccb33ccd9028ff505d9979fd6c8a37393b892d which changes Assuan's waitpid function for Windows is well aligned with the my_waitpid in gpgme's assuan-support.c (which does nothing). gpgme creates a detached process in most cases but for gpgsm assuan_pipe_connect is used without the ASSUAN_PIPE_CONNECT_DETACHED flag.

Tue, Aug 12, 11:12 AM · gnupg26, gpgme, kleopatra, gpd5x
werner added a comment to T7759: Kleopatra: Notepad encryption with S/MIME fails.

Another data point is that the faulty versions use libassuan 3 with a slightly changed API. May one of the follwing chnages cause the problem?

Tue, Aug 12, 10:51 AM · gnupg26, gpgme, kleopatra, gpd5x

Mon, Aug 11

ebo added a comment to T7759: Kleopatra: Notepad encryption with S/MIME fails.

Although in VSD 3.2.2 we get no warning when configuring S/MIME debugging wrong we then get a nice message "Configuration error" when trying to encrypt with S/MIME, instead of gpgsm hanging without any message at all:

Mon, Aug 11, 5:23 PM · gnupg26, gpgme, kleopatra, gpd5x

Fri, Aug 8

ebo added a comment to T7759: Kleopatra: Notepad encryption with S/MIME fails.

The issue also occurs in VSD-3.3.2 and 4win-4.4.1 but not in VSD 3.1.26

Fri, Aug 8, 2:20 PM · gnupg26, gpgme, kleopatra, gpd5x
werner triaged T7759: Kleopatra: Notepad encryption with S/MIME fails as High priority.
Fri, Aug 8, 6:33 AM · gnupg26, gpgme, kleopatra, gpd5x

Jul 12 2025

alexk added a comment to T7660: GPGME invocation by cri-o hangs on gpgme_op_verify.

I created a Go test program that runs several Go routines, each of which verifies a byte array loaded from a file in advance. Each go-routine is spawned with a configurable delay in milliseconds. I tested it with 100 iterations, which resulted in at least 50 parallel processes. Each verification process uses its own context, as Crio does. I didn't encounter any errors.

Here is my repository with a README containing more information: https://git.sr.ht/~kulbartsch/gpgmego-verify-load-test

Jul 12 2025, 12:27 PM · golang, gpgme, Bug Report

Jun 30 2025

timegrid moved T6694: Random numbers from gpgme from Backlog to Done on the gpd5x board.

Ingo tested this and it worked.

Jun 30 2025, 11:02 AM · gpd5x, gpgpass, gpgme, Feature Request

Jun 26 2025

gniibe changed the status of T7696: POSIX: spawn fixes, a subtask of T7660: GPGME invocation by cri-o hangs on gpgme_op_verify, from Open to Testing.
Jun 26 2025, 6:49 AM · golang, gpgme, Bug Report

Jun 23 2025

gniibe changed the status of T7694: GPGME: gpgme_io_spawn issues from Open to Testing.

Done by: rM8caa7cc517eb: Use sysconf as a fallback mechanism in the initialization.

Jun 23 2025, 7:17 AM · gpgme, Bug Report
gniibe changed the status of T7694: GPGME: gpgme_io_spawn issues, a subtask of T7660: GPGME invocation by cri-o hangs on gpgme_op_verify, from Open to Testing.
Jun 23 2025, 7:17 AM · golang, gpgme, Bug Report

Jun 20 2025

gniibe added a comment to T7694: GPGME: gpgme_io_spawn issues.

OK. I'll add a code for setting the fallback value in _gpgme_io_subsystem_init and use it from get_max_fds.

Jun 20 2025, 10:35 AM · gpgme, Bug Report
werner added a comment to T7694: GPGME: gpgme_io_spawn issues.

iirc we introduced sysconf (_SC_OPEN_MAX) for non-linux platforms and that fixed real world problems. What about getting this value at module initialization time and keep on using it as a fallback?

Jun 20 2025, 10:13 AM · gpgme, Bug Report
gniibe updated the task description for T7694: GPGME: gpgme_io_spawn issues.
Jun 20 2025, 2:28 AM · gpgme, Bug Report
gniibe added a comment to T7660: GPGME invocation by cri-o hangs on gpgme_op_verify.

For issues of get_max_fds, I created a sub task, although it seems not the direct cause of this particular problem.

Jun 20 2025, 2:13 AM · golang, gpgme, Bug Report
gniibe removed a project from T7694: GPGME: gpgme_io_spawn issues: golang.
Jun 20 2025, 2:09 AM · gpgme, Bug Report
gniibe triaged T7694: GPGME: gpgme_io_spawn issues as Normal priority.
Jun 20 2025, 2:07 AM · gpgme, Bug Report

Jun 19 2025

gniibe added a comment to T7660: GPGME invocation by cri-o hangs on gpgme_op_verify.

I test following test program (gcc -o t-gmf t-gmf.c) on Debian machine of S390x.

Jun 19 2025, 9:26 AM · golang, gpgme, Bug Report

Jun 17 2025

gniibe added a comment to T7660: GPGME invocation by cri-o hangs on gpgme_op_verify.

In the log, we can observe duplicated lines generated by
https://dev.gnupg.org/source/gpgme/browse/master/src/posix-io.c$545
Example is like:

2025-05-19 20:16:35 gpgme[21970.55d7]   _gpgme_io_spawn: check: fd[0] = 0x1c -> 0x1
2025-05-19 20:16:35 gpgme[21970.55d7]   _gpgme_io_spawn: check: fd[0] = 0x1c -> 0x1
Jun 17 2025, 10:01 AM · golang, gpgme, Bug Report

Jun 5 2025

Saturneric added a comment to T7620: gpgme_get_key fails to detect secret encryption subkey after key generation on card (until context is recreated).

In practice, calling gpgme_get_key() will often pick up most changes because GPGME asks the underlying GPG agent daemon, which may re-read the keyring. That gives the impression that a long-lived context automatically reflects live updates. However, as aheinecke noted, some updates can still go unnoticed in a single gpgme_ctx_t, so it isn’t a strictly frozen snapshot nor a perfectly live view—behaviors are mixed.

Jun 5 2025, 12:33 PM · gnupg26, gnupg, Bug Report
Saturneric added a comment to T7620: gpgme_get_key fails to detect secret encryption subkey after key generation on card (until context is recreated).

Maybe we should make the documentation clearer about context key reuse. But the context is specifically designed to cache information about a key, so as to avoid memory overhead. I learned early on that its best for each new operation to use a new context. A context is basically an instance of gpg or gpgsm. So you start one process, ask it for a keylist, keep the process running, start another process, modify the key database, and then ask the first process again about his worldview. Either the first process is a bit confused because it has read data and then that data changed (what happens here) or it has no idea about the change since it was efficient and only read the database once. But here in this example you should be able to reproduce this also by making any other modifications to the key, adding other subkeys, userids etc. That GPGME even notices the secret key is more of a side effect of how the programming works because the GPGME gpg process will ask the gpg-agent (so a third process).

Jun 5 2025, 12:14 PM · gnupg26, gnupg, Bug Report
Saturneric added a comment to T7673: Release GPGME 2.0.0.

We will keep the 1.24 branch for bug fixing. Do you really have a problem with gpgme 2.0? Ist that due to factoring out the c++ and qt bindings? That was actually a long standing request from the KDE community so that they can use their cmake stuff.

Jun 5 2025, 11:50 AM · Release Info, gpgme
werner added a comment to T7673: Release GPGME 2.0.0.

We will keep the 1.24 branch for bug fixing. Do you really have a problem with gpgme 2.0? Ist that due to factoring out the c++ and qt bindings? That was actually a long standing request from the KDE community so that they can use their cmake stuff.

Jun 5 2025, 11:37 AM · Release Info, gpgme
Saturneric added a comment to T7673: Release GPGME 2.0.0.

I'm wondering whether gpgme v1 will still be supported? Or it will be abandoned from now on.

Jun 5 2025, 10:37 AM · Release Info, gpgme

Jun 4 2025

sj98ta added a comment to T7660: GPGME invocation by cri-o hangs on gpgme_op_verify.

No other processes that I have seen. However please see this last update by Kulbarsch. https://github.com/cri-o/cri-o/issues/8906#issuecomment-2936351035

Jun 4 2025, 12:55 PM · golang, gpgme, Bug Report
gniibe added a comment to T7660: GPGME invocation by cri-o hangs on gpgme_op_verify.

@sj98ta
Does cri-o invokes processes (other than the ones of gpgme) by its threads?

Jun 4 2025, 2:07 AM · golang, gpgme, Bug Report

Jun 3 2025

werner closed T3325: Allow encryption/signing in GPGME using a specified subkey as Resolved.
Jun 3 2025, 5:29 PM · gpgme
sj98ta added a comment to T7660: GPGME invocation by cri-o hangs on gpgme_op_verify.

I am not sure that I am clear on what you are asking. I am not an expert on cri-o, but is does seem that there are multiple processes (threads), which all call gpgme_op_verify There are also calls to gpgme_op_import

Jun 3 2025, 3:59 PM · golang, gpgme, Bug Report
werner updated the task description for T7440: Release GPGME 1.24.1.
Jun 3 2025, 1:10 PM · gpgme, Release Info
werner triaged T7673: Release GPGME 2.0.0 as Normal priority.
Jun 3 2025, 1:09 PM · Release Info, gpgme
gniibe added a comment to T7660: GPGME invocation by cri-o hangs on gpgme_op_verify.

@sj98ta Please let us know if cri-o invokes other processes (except the ones by gpgme) or not.
If cri-o invokes other processes (by other threads), my theory matters; With the interference by other processes holding pipe file descriptors, gpgme keeps polling pipe file descriptors.

Jun 3 2025, 9:05 AM · golang, gpgme, Bug Report

Jun 2 2025

sj98ta added a comment to T7660: GPGME invocation by cri-o hangs on gpgme_op_verify.

I have now seen instances where 1, 2, or 3 processes hang.

Jun 2 2025, 5:31 PM · golang, gpgme, Bug Report

May 30 2025

werner added a comment to T7660: GPGME invocation by cri-o hangs on gpgme_op_verify.

Re: pipe2: In gpgme_io_pipe we set FD_CLOEXEC only for one end of the pipe. Thus simply using pipe2 would change the behaviour.

May 30 2025, 11:09 AM · golang, gpgme, Bug Report
gniibe added a comment to T7660: GPGME invocation by cri-o hangs on gpgme_op_verify.

Here is a hypothetical application which may have similar problem.
(1) It is a multi threaded application using gpgme, forking another process (possibly, exec).
(2) One of threads invokes gpgme_new, gpgme_op_import and gpg_op_verify.
(3) When the control goes to gpgme_op_* then gpgme_io_spawn by a thread A, another thread B forks a process.
(3-1) While the thread A is polling pipe I/O, forked process holds pipe file descriptors too.
(3-2) Until the forked process exists, pipe I/O polling by the thread A continues (because pipe's other end is still active).

May 30 2025, 7:06 AM · golang, gpgme, Bug Report
collinfunk added a comment to T7660: GPGME invocation by cri-o hangs on gpgme_op_verify.

There is FD_CLOFORK on Solaris 11.4 as well. It is a part of POSIX-1.2024, but who knows how long until that becomes common.

May 30 2025, 5:05 AM · golang, gpgme, Bug Report
gniibe added a comment to T7660: GPGME invocation by cri-o hangs on gpgme_op_verify.

I don't know if it is related to this particular case, but I found a possible race condition in _gpgme_io_pipe.
Between pipe and fcntl with FD_CLOEXEC, another thread may fork a process which keeps running.
It would be good to use pipe2 here:
https://pubs.opengroup.org/onlinepubs/9799919799/functions/pipe.html

May 30 2025, 4:46 AM · golang, gpgme, Bug Report

May 29 2025

gniibe added a comment to T7660: GPGME invocation by cri-o hangs on gpgme_op_verify.

Another possible cause is... gpgme uses closefrom in GNU C library, if available. if it doesn't work well, it would be possible invoked gpg keeps waiting its input.

May 29 2025, 11:02 AM · golang, gpgme, Bug Report
gniibe added a comment to T7660: GPGME invocation by cri-o hangs on gpgme_op_verify.

Here is my observation.

May 29 2025, 9:11 AM · golang, gpgme, Bug Report

May 28 2025

aheinecke added a comment to T7620: gpgme_get_key fails to detect secret encryption subkey after key generation on card (until context is recreated).

I do not think that this is the only place where such an issue occurs. Maybe we should make the documentation clearer about context key reuse. But the context is specifically designed to cache information about a key, so as to avoid memory overhead. I learned early on that its best for each new operation to use a new context. A context is basically an instance of gpg or gpgsm. So you start one process, ask it for a keylist, keep the process running, start another process, modify the key database, and then ask the first process again about his worldview. Either the first process is a bit confused because it has read data and then that data changed (what happens here) or it has no idea about the change since it was efficient and only read the database once. But here in this example you should be able to reproduce this also by making any other modifications to the key, adding other subkeys, userids etc. That GPGME even notices the secret key is more of a side effect of how the programming works because the GPGME gpg process will ask the gpg-agent (so a third process).

May 28 2025, 9:19 PM · gnupg26, gnupg, Bug Report

May 27 2025

werner triaged T7660: GPGME invocation by cri-o hangs on gpgme_op_verify as Normal priority.
May 27 2025, 4:29 PM · golang, gpgme, Bug Report

May 23 2025

ebo moved T7600: Kleopatra: gpg.exe hangs on trying to exportably certify an already locally signed certificate with multiple UIDs from Restricted Project Column to Restricted Project Column on the Restricted Project board.
May 23 2025, 10:14 AM · Restricted Project, vsd33 (vsd-3.3.1), gpgme, gpd5x, kleopatra
ebo added a project to T7600: Kleopatra: gpg.exe hangs on trying to exportably certify an already locally signed certificate with multiple UIDs: Restricted Project.
May 23 2025, 10:13 AM · Restricted Project, vsd33 (vsd-3.3.1), gpgme, gpd5x, kleopatra

May 20 2025

timegrid moved T6907: gpgme: Explicitly tell gpg that we want to verify signed data from Restricted Project Column to Restricted Project Column on the Restricted Project board.

looks good to me on gpg4win-4.4.1-beta59@win10

May 20 2025, 12:07 PM · gpgme, Restricted Project