gpgme_op_keylist_start: error: Invalid crypto engine <GPGME>

Hans-Christoph Steiner hans at
Mon Oct 22 06:02:47 CEST 2012

On 10/19/2012 05:28 AM, Werner Koch wrote:
> On Fri, 19 Oct 2012 06:26, hans at said:
>> I didn't get very far today.  A patch with printf()s would be much
>> appreciated.
> Okay, I did something more general.
>   bd24fea Trace the use of GPG_ERR_INV_ENGINE.
>     * src/debug.h: Include "gpgme.h"
>     (_gpgme_trace_gpgme_error): New.
>     (trace_gpg_error): New macro.  Use it in all files where we return
>     GPG_ERR_INV_ENGINE; also "include debug.h" as needed.
>     --
>     This is a pretty common error code but often it is hard to figure out
>     the actual cause.  With debug level 4 we now print the file name and
>     line number where this error code is generated by gpgme.  Along with
>     the git revision printed in the first log lines, this should give us
>     an easier way to track down the problems related to this error code.
> Sample output is now
>     engine-gpg.c:1272: returning error: Invalid crypto engine
>     gpgme_op_keylist_start: error: Invalid crypto engine <GPGME>
> With the exact location it should be easy to figure out what's going
> wrong.

That is getting more information, its stopping here:

GPGME 2012-10-17 20:48:00 <0x0909>  gpgme_op_keylist_start: enter:
ctx=0x2a0d8818, pattern=ans, secret_only=0
GPGME 2012-10-17 20:48:00 <0x0909>  engine.c:456: returning error: Invalid
crypto engine
GPGME 2012-10-17 20:48:00 <0x0909>  gpgme_op_keylist_start: error: Invalid
crypto engine <GPGME>

448 _gpgme_engine_new (gpgme_engine_info_t info, engine_t *r_engine)
449 {
450   engine_t engine;
452   if (!info->file_name)
453     return trace_gpg_error (GPG_ERR_INV_ENGINE);
455   if (!info->version)
456     return trace_gpg_error (GPG_ERR_INV_ENGINE);

I split them up to get the exact var.  So the version is not getting set.  The
code is using gpgme_check_version(NULL) like the example says:

JNI_OnLoad(JavaVM *vm, void *reserved)
    _jvm = vm;

    // TODO set locale from the JavaVM's config
    setlocale(LC_ALL, "");

    const char* version = gpgme_check_version(NULL);
    fprintf(stderr, "VERSION: %s\n", version);
    gpgme_set_locale(NULL, LC_CTYPE, setlocale(LC_CTYPE, NULL));

So next thing might be to try setting a version, but its late and I'm going to
bed.  Would that be something like:

    const char* version = gpgme_check_version("1.3.0");


More information about the Gnupg-devel mailing list