Format of text and signature for GPGME

Laurent CHEYLUS foxy at
Fri Feb 15 19:10:02 CET 2002


I use GPGME library to develop GPG support in Balsa (MUA of Gnome) but I
have some problems to verify a "PGP Signed Message" with
"gpgme_op_verify" function :-(

I have develop a function to extract text and PGP signature from the
body of a mail message but when I try to verify this PGP signed message,
 status or GPGME_SIG_STAT_BAD (when I have GPG key for sign in my pub
keyring) but no 

My code is :

static void gpg_sign_verify(gchar *text, gchar *sign)
    GpgmeCtx ctx;
    GpgmeError err;
    GpgmeData sig, txt;
    GpgmeSigStat status;

    err = gpgme_new (&ctx);
    fail_if_err (err);

    err = gpgme_data_new_from_mem ( &txt, text, strlen (text), 0 );
    fail_if_err (err);
    err = gpgme_data_new_from_mem ( &sig, sign, strlen (sign), 0 );
    fail_if_err (err);

    err = gpgme_op_verify (ctx, sig, txt, &status );
    fail_if_err (err);
    print_sig_stat ( ctx, status );

    gpgme_data_release (sig);
    gpgme_data_release (txt);
    gpgme_release (ctx);

where ptr is a char* with body of mail message.

I think that I have some errors when I read text and sign datas from
body. What must be the format for the PGP signed message and cleartext
signature, in the "gpgme_op_verify" function ?

Must the text begin with "-----BEGIN PGP SIGNED MESSAGE-----" or this
header  must be suppress ? Must the signature begin with "-----BEGIN PGP
SIGNATURE-----" and finsih with "-----END PGP SIGNATURE-----" ? Must
these lines finish with "\n" or another caracter ?


More information about the Gnupg-devel mailing list