What function to get the data out of the signed pgp data?

Werner Koch wk at gnupg.org
Tue Aug 14 19:03:33 CEST 2007


On Tue, 14 Aug 2007 17:49, swalker at bynari.net said:

> I meant using the pgpme functions.

 -- Function: gpgme_error_t gpgme_op_verify (gpgme_ctx_t CTX,
          gpgme_data_t SIG, gpgme_data_t SIGNED_TEXT,
          gpgme_data_t PLAIN)
     The function `gpgme_op_verify' verifies that the signature in the
     data object SIG is a valid signature.  If SIG is a detached
     signature, then the signed text should be provided in SIGNED_TEXT
     and PLAIN should be a null pointer.  Otherwise, if SIG is a normal
     (or cleartext) signature, SIGNED_TEXT should be a null pointer and
     PLAIN should be a writable data object that will contain the
     plaintext after successful verification.

     The results of the individual signature verifications can be
     retrieved with `gpgme_op_verify_result'.

     The function returns the error code `GPG_ERR_NO_ERROR' if the
     operation could be completed successfully, `GPG_ERR_INV_VALUE' if
     CTX, SIG or PLAIN is not a valid pointer, `GPG_ERR_NO_DATA' if SIG
     does not contain any data to verify, and passes through any errors
     that are reported by the crypto engine support routines.

Thus in case of a cleartext signature you do something like this:

     gpgme_data_t in, out;

     gpgme_data_new (&in);
     write_stuff_to (in);
     gpgme_data_new (&out);
     gpgme_op_verify (ctx, in, NULL, out);
     gpgme_data_seek (out, 0, SEEK_SET);
     print_signed_stuff (out);


Shalom-Salam,

   Werner




More information about the Gnupg-devel mailing list