signing message problem

Marcus Brinkmann marcus.brinkmann at ruhr-uni-bochum.de
Wed Aug 9 08:37:37 CEST 2006


At Tue, 08 Aug 2006 22:38:17 +0200,
Hajdu Péter <hp489 at hszk.bme.hu> wrote:
> 
> Hi!
> 
> 	I've got a problem while signing message with gpgme. I'm really new to 
> gpgme, so please be patient. Here is my code:
[...]
> 	error = gpgme_op_sign( context, message, signature, 
> GPGME_SIG_MODE_NORMAL );
>   	gpgme_data_release(message);
> 	printf("%s\n",gpg_strerror( error ));
> 	memset(buf,0,sizeof(buf));

You need to rewind the file pointer here:

gpgme_data_seek (signature, 0, SEEK_SET);

> 	printf("%d\n",gpgme_data_read( signature, buf, sizeof(buf) ));
> 	printf("%s",buf);
> 	gpgme_data_release(signature);
> 	gpgme_release(context);
> 	
> 
> That's not the entire code, I've cut out error handling.

As a side note, it's recommended (by me :) to always send small, but
complete examples, ie files that compile, and with error handling.
This allows others to reproduce the problem easier.  In this case, I
could see the mistake immediately, but this is not always the case.

Thanks,
Marcus




More information about the Gnupg-devel mailing list