GPGME: Signature summary

Matthias Fuchs mat69 at gmx.net
Thu Oct 15 17:32:20 CEST 2009


Hi,

I do a verification of a file and what baffles me is the summary of the 
signature. If I use a wrong file it correctly outputs GPGME_SIGSUM_RED, yet if 
the file is correct it outputs 0 instead of GPGME_SIGSUM_VALID (==1). I wonder 
if that is a bug somewhere in GPGME.

Just to be sure that it is not an error in my code I post it here (removed 
error handling/cleaning up to make it more readable):

    std::cout << "Version: " << gpgme_check_version(0) << std::endl;

    gpgme_ctx_t ctx = 0;
    gpgme_error_t err = gpgme_new(&ctx);
    err = gpgme_engine_check_version(GPGME_PROTOCOL_OpenPGP);

    if (gpgme_set_protocol(ctx, GPGME_PROTOCOL_OpenPGP)) {
        std::cerr << "ERROR: Setting protocol failed." << std::endl;
        return;
    }

    gpgme_data_t data;
    std::FILE *dataFile;
    dataFile = std::fopen("/home/kde-devel/test-meta/pgp/patch-2.6.31.gz", 
"r");
    err = gpgme_data_new_from_stream(&data, dataFile);

    gpgme_data_t sig;
    std::FILE *sigFile;
    sigFile = std::fopen("/home/kde-devel/test-meta/pgp/patch-2.6.31.gz.sign", 
"r");
    err = gpgme_data_new_from_stream(&sig, sigFile);

    err = gpgme_op_verify(ctx, sig, data, 0);
    const gpgme_verify_result_t result = gpgme_op_verify_result(ctx);

    gpgme_signature_t signature = result->signatures;
    while (signature) {
        std::cout << "Status: " << gpgme_err_code(signature->status) << " 
summary:  " << signature->summary << std::endl;
        signature = signature->next;
    }

It reports "Status: 0 summary: 0", while it should imo be "Status: 0 summary: 
1"

Cheers,
matthias




More information about the Gnupg-devel mailing list