gpgme_op_verify problem
    Mario Lenz 
    m at riolenz.de
       
    Mon Jul  9 18:46:39 CEST 2007
    
    
  
Hi!
I already asked this on the gnupg-users list, but since nobody helped, I
have the same problem with 1.1.5 and "Bug reports and requests for
assistance should be sent to" this list...
I'm trying to get the plain text out of a signature:
#include <stdlib.h>
#include <stdio.h>
#include <gpgme.h>
int
main (int argc, char **argv)
{
  gpgme_ctx_t ctx;
  gpgme_error_t err;
  gpgme_data_t plain, signed_text;
  char buffer[100];
  ssize_t size;
  printf ("%s\n", gpgme_check_version (NULL));
  err = gpgme_engine_check_version (GPGME_PROTOCOL_OpenPGP);
  if (err) exit (1);
  err = gpgme_new (&ctx);
  if (!err)
    {
      err = gpgme_set_protocol(ctx, GPGME_PROTOCOL_OpenPGP);
    }
  if (err) exit (2);
  err = gpgme_data_new_from_mem (&plain, "Hallo Leute\n", 13, 1);
  if (err) exit (3);
  err = gpgme_data_new (&signed_text);
  if (err) exit (4);
  err = gpgme_op_sign (ctx, plain, signed_text, GPGME_SIG_MODE_NORMAL);
  if (err) exit (5);
  gpgme_data_release (plain);
  err = gpgme_data_new (&plain);
  if (err) exit (6);
  gpgme_data_seek (signed_text, 0, SEEK_SET);
  err = gpgme_op_verify (ctx, signed_text, NULL, plain);
  if (err) exit (7);
  gpgme_data_seek (plain, 0, SEEK_SET);
  size = gpgme_data_read (plain, buffer, 100);
  if (size > 0)
    printf("%s\n", buffer);
  else
    printf("failed with size %d\n", size);
  gpgme_data_release (plain);
  gpgme_data_release (signed_text);
  gpgme_release (ctx);
  return 0;
}
Compiling with: gcc -o test_rme test_rme.c
"$HOME"/src/gpgme-1.1.5/gpgme/.libs/libgpgme.so -Wl,--rpath
-Wl,"$HOME"/src/gpgme-1.1.5/gpgme/.libs
Output ./test_rme:
1.1.5
failed with size 0
Am I doing it wrong or *is* there a bug?
greez
   Mario
PS
Normally I wouldn't have sent a mail again... but since you released a
new version I wanted to inform you that the problem still exists. And as
long as you don't tell me my code is wrong I'll consider it a bug in
gpgme :-)
--
Rule One: Do not act incautiously when confronting little bald wrinkly
smiling men.
    
    
More information about the Gnupg-devel
mailing list