GPGME and verification of normal signatures
Marcus Brinkmann
Marcus.Brinkmann@ruhr-uni-bochum.de
Sun Mar 3 17:58:02 2002
On Fri, Feb 15, 2002 at 07:08:09PM +0100, Laurent CHEYLUS wrote:
> 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 :-(
[...]
> 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 ?
On Sat, Feb 16, 2002 at 05:12:04PM +0100, Andreas Agorander wrote:
> 1. Looking through the documentation it seems like only detached signatures
> can be verified by GPGME, is there any possibility to verify a clearsigned
> message directly, or do I have to "separate" the signature from the message?
The gpgme_op_verify function in CVS now supports that the plaintext argument
is an _uninitialized_ data object and will return the plaintext data for a
normal or cleartext signature in that. Here is an example how this can be
done (mmmh, such examples should be in the manual :)
const char *signed_message = "-----BEGIN PGP SIGNED MESSAGE-----...";
GpgmeData sig, text;
GpgmeSigStat sigstat;
char *plaintext;
int plaintext_len;
gpgme_data_new (&text);
gpgme_data_new_from_mem (&sig, signed_message, strlen (signed_message), 0);
gpgme_op_verify (ctx, sig, text, &sigstat);
plaintext = gpgme_data_release_and_get_mem (text, &plaintext_len);
...
Please let me know if you experience any problems with it.
Thanks,
Marcus
--
`Rhubarb is no Egyptian god.' Debian http://www.debian.org brinkmd@debian.org
Marcus Brinkmann GNU http://www.gnu.org marcus@gnu.org
Marcus.Brinkmann@ruhr-uni-bochum.de
http://www.marcus-brinkmann.de