gpgme_op_verify behaves weird

Francois Gaudin alf at bordel-ambiant.org
Tue Sep 5 14:55:55 CEST 2006


Really thank you for all these explainations.

I've corrected my code and now error codes are more meaningfull for me. But I 
can't understand why this failed to verify. I sign and verify and nothing 
more.

	result = gpgme_op_sign(context, msg,signature, GPGME_SIG_MODE_DETACH) ;
	Q_ASSERT(gpgme_err_code(result) == GPG_ERR_NO_ERROR || gpgme_err_code(result) 
== GPG_ERR_BAD_PASSPHRASE || gpgme_err_code(result) == GPG_ERR_CANCELED) ;

	// test
	gpgme_data_rewind(signature) ;
	gpgme_data_rewind(msg) ;
	result = gpgme_op_verify (context, signature, msg , 0) ;
	qDebug() << "verify result" << gpgme_err_code(result) ;
	Q_ASSERT(gpgme_err_code(result) != GPG_ERR_INV_VALUE) ;
	Q_ASSERT(gpgme_err_code(result) != GPG_ERR_NO_DATA) ;
	Q_ASSERT(result == GPG_ERR_NO_ERROR) ;
	qDebug() << "verify" ;
	
	gpgme_verify_result_t verification = gpgme_op_verify_result(context) ;
	Q_ASSERT(verification != NULL) ;
	qDebug() << "result" ;
	
	gpgme_signature_t signatures = verification->signatures ;
	Q_ASSERT(verification->signatures != NULL) ;
	gpgme_error_t status = signatures->status ;
	qDebug() << "status" << gpgme_err_code(status) ;
	// test

output :

verify result 0
verify
result
status 8
signature "-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.2.2 (GNU/Linux)

iD8DBQFE/XKv3r3TxDvLjIQRAi5SAKCODnDtKwtCCbfRnkXI8hd4E8VX1ACcDGyd
kkScz6pUEiCABCYzQOI/4Yw=
=Vf9z
-----END PGP SIGNATURE-----
"

and : alf at gros:~/gpl_projects/torrentlibre/tlclient$ gpg-error 8
8 = (0, 8) = (GPG_ERR_SOURCE_UNKNOWN, GPG_ERR_BAD_SIGNATURE) = (Source 
non-spécifiée, Mauvaise signature)

--
Francois Gaudin
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 829 bytes
Desc: not available
Url : /pipermail/attachments/20060905/d47e47ff/attachment.pgp


More information about the Gnupg-devel mailing list