GPGME listkey issue

cube cube@cubidou.net
Sun Sep 9 16:22:01 2001


GPGME doesn't get the last key listed by gpg. It's a little annoying.

My configuration :

gpg	1.0.6
gpgme	0.2.2

I'm not sure if the following info will be useful, but i guess too much is
better than too few.

distro -> Slackware 8
glibc -> 1.2.10

And here's an example output :

[cube@c3po test_gpgme]$ gpg --list-keys --with-colons --fixed-list-mode
--with-fingerprint
/home/cube/.gnupg/pubring.gpg
-----------------------------
pub:u:1024:17:4146B13D5C8A3F2A:999940363::59:-:::scESC:
fpr:::::::::3D1E20789F8FEB1C46062E8D4146B13D5C8A3F2A:
uid:u::::::::Quentin Garnier <Quentin.Garnier@nerim.net>:
uid:u::::::::cubidou <cube@cubidou.net>:
sub:u:1024:16:5DA24287F8F06F57:999940375::59::::e:
pub:q:1024:17:F573D4AB3EEC8A76:999988912::66:-:::scESC:
fpr:::::::::BBFC13A47F564C9481D4CA65F573D4AB3EEC8A76:
uid:q::::::::Jerome Roux <jerome@e-roux.net>:
sub:q:1024:16:27F46FB8589EFD32:999988950::66::::e:
pub:q:1024:17:7E13FB813E4FCECC:999983619::71:-:::scESC:
fpr:::::::::339DCF141390E008A7F842827E13FB813E4FCECC:
uid:q::::::::Yann Trebouta <yann.trebouta@wanadoo.fr>:
uid:q::::::::MoonZ (Dragoon) <moonz@wanadoo.fr>:
sub:q:1024:16:14801A30D87E80B1:999983630::71::::e:

[cube@c3po test_gpgme]$ ./test_gpgme 
gpgme_new: 0
gpgme_op_keylist_start: 0
gpgme_op_keylist_next: 0
Clé obtenue: cube@cubidou.net
gpgme_op_keylist_next: 0
Clé obtenue: jerome@e-roux.net
gpgme_op_keylist_next: -1

And here's test_gpgme.c code :

main(int argc, char** argv)
{
        GpgmeCtx ctx;
        GpgmeError err;
        GpgmeKey key;
        char* pattern;

        err = gpgme_new( &ctx );
        printf("gpgme_new: %d\n", err );

        if( argc > 1 )
                pattern = *(argv+1);
        else
                pattern = NULL;

        err = gpgme_op_keylist_start( ctx, pattern , 0 );
        printf("gpgme_op_keylist_start: %d\n", err );

        while( !(err = gpgme_op_keylist_next( ctx, &key )) )
        {
                printf("gpgme_op_keylist_next: %d\n", err );
                printf("Clé obtenue: %s\n", gpgme_key_get_string_attr( key,
                                                        GPGME_ATTR_EMAIL, NULL,
0 ));
        }
        printf( "gpgme_op_keylist_next: %d\n", err );
        gpgme_release( ctx );
}

cube

-- 
Things involved in computer fill me with childlike terror.
Giles in Buffy the Vampire Slayer, S01EP08, I Robot, You Jane.