List Info

Thread: gpgme_op_verify behaves weird




gpgme_op_verify behaves weird
user name
2006-09-05 12:55:55
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/XKv3r3TxDvLjIQRAi5SAKCODnDtKwtCCbfRnkXI8hd4E8VX1ACc
DGyd
kkScz6pUEiCABCYzQOI/4Yw=
=Vf9z
-----END PGP SIGNATURE-----
"

and : alfgros:~/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
_______________________________________________
Gnupg-devel mailing list
Gnupg-develgnupg.org
h
ttp://lists.gnupg.org/mailman/listinfo/gnupg-devel
gpgme_op_verify behaves weird
user name
2006-09-05 13:36:47
At Tue, 5 Sep 2006 14:55:55 +0200,
Francois Gaudin <alfbordel-ambiant.org> wrote:
> 
> 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.

I am not sure.  You may want to try to write out MSG and
SIGNATURE and
see if they verify on the command line.  You may also want
to try
running with environment variable GPGME_DEBUG=3, to see the
communication between GPGME and GPG.

If you still have trouble, please provide a small example
which is
self-contained, ie can be compiled and run, so I can try to
reproduce
the problem.

Thanks,
Marcus



_______________________________________________
Gnupg-devel mailing list
Gnupg-develgnupg.org
h
ttp://lists.gnupg.org/mailman/listinfo/gnupg-devel
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )