* GPGME_ATTR_IS_SECRET is not anymore representable as a string.
+ * gpgme_op_verify and gpgme_op_decrypt_verify don't return a status
+ summary anymore. Use gpgme_get_sig_status to retrieve the individual stati.
+
* Interface changes relative to the 0.4.0 release:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-gpgme_key_get_string_attr CHANGED: Don't handle GPGME_ATR_IS_SECRET.
+gpgme_key_get_string_attr CHANGED: Don't handle GPGME_ATTR_IS_SECRET.
+gpgme_op_verify CHANGED: Drop R_STAT argument.
+gpgme_op_decrypt_verify CHANGED: Drop R_STAT argument.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Noteworthy changes in version 0.4.0 (2002-12-23)
+2002-12-24 Marcus Brinkmann <marcus@g10code.de>
+
+ * gpgme.texi (Verify): Drop R_STAT argument in gpgme_op_verify.
+ * gpgme.texi (Decrypt and Verify): Likewise for
+ gpgme_op_decrypt_verify.
+
2002-12-23 Marcus Brinkmann <marcus@g10code.de>
* gpgme.texi (Information About Keys): Document that
@end deftp
-@deftypefun GpgmeError gpgme_op_verify (@w{GpgmeCtx @var{ctx}}, @w{GpgmeData @var{sig}}, @w{GpgmeData @var{signed_text}}, @w{GpgmeData @var{plain}}, @w{GpgmeSigStat *@var{r_stat}})
+@deftypefun GpgmeError gpgme_op_verify (@w{GpgmeCtx @var{ctx}}, @w{GpgmeData @var{sig}}, @w{GpgmeData @var{signed_text}}, @w{GpgmeData @var{plain}})
The function @code{gpgme_op_verify} verifies that the signature in the
data object @var{sig} is a valid signature. If @var{sig} is a
detached signature, then the signed text should be provided in
writable data object that will contain the plaintext after successful
verification.
-The combined status of all signatures is returned in @var{r_stat}.
The results of the individual signature verifications can be retrieved
with @code{gpgme_get_sig_status} and @code{gpgme_get_sig_key}.
@cindex signature check
@cindex cryptographic operation, decryption and verification
-@deftypefun GpgmeError gpgme_op_decrypt_verify (@w{GpgmeCtx @var{ctx}}, @w{GpgmeData @var{cipher}}, @w{GpgmeData @var{plain}}, @w{GpgmeSigStat *@var{r_stat}})
+@deftypefun GpgmeError gpgme_op_decrypt_verify (@w{GpgmeCtx @var{ctx}}, @w{GpgmeData @var{cipher}}, @w{GpgmeData @var{plain}})
The function @code{gpgme_op_decrypt_verify} decrypts the ciphertext in
the data object @var{cipher} and stores it into the data object
@var{plain}. If @var{cipher} contains signatures, they will be
-verified and their combined status will be returned in @var{r_stat}.
+verified.
After the operation completed, @code{gpgme_op_get_sig_status} and
@code{gpgme_op_get_sig_key} can be used to retrieve more information
+2002-12-24 Marcus Brinkmann <marcus@g10code.de>
+
+ * gpgme.h (gpgme_op_verify, gpgme_op_decrypt_verify): Drop R_STAT
+ argument.
+ * decrypt-verify.c (gpgme_op_decrypt_verify): Drop R_STAT
+ argument.
+ * verify.c (gpgme_op_verify): Drop R_STAT argument.
+ (_gpgme_intersect_stati): Function removed.
+ * ops.h (_gpgme_intersect_stati): Remove prototype.
+
2002-12-24 Marcus Brinkmann <marcus@g10code.de>
* libgpgme.vers: New file.
/* decrypt-verify.c - decrypt and verify functions
- * Copyright (C) 2000 Werner Koch (dd9jn)
- * Copyright (C) 2001, 2002 g10 Code GmbH
- *
- * This file is part of GPGME.
- *
- * GPGME is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GPGME is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
+ Copyright (C) 2000 Werner Koch (dd9jn)
+ Copyright (C) 2001, 2002 g10 Code GmbH
+ This file is part of GPGME.
+
+ GPGME is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ GPGME is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GPGME; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+#if HAVE_CONFIG_H
#include <config.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
* Return value: 0 on success or an errorcode.
**/
GpgmeError
-gpgme_op_decrypt_verify (GpgmeCtx ctx,
- GpgmeData in, GpgmeData out,
- GpgmeSigStat *r_stat)
+gpgme_op_decrypt_verify (GpgmeCtx ctx, GpgmeData in, GpgmeData out)
{
GpgmeError err;
gpgme_data_release (ctx->notation);
ctx->notation = NULL;
- *r_stat = GPGME_SIG_STAT_NONE;
err = _gpgme_decrypt_start (ctx, 1, in, out,
decrypt_verify_status_handler);
if (!err)
- {
- err = _gpgme_wait_one (ctx);
- if (!err)
- *r_stat = _gpgme_intersect_stati (ctx->result.verify);
- }
+ err = _gpgme_wait_one (ctx);
return err;
}
GpgmeError gpgme_op_decrypt_verify_start (GpgmeCtx ctx,
GpgmeData cipher, GpgmeData plain);
GpgmeError gpgme_op_decrypt_verify (GpgmeCtx ctx,
- GpgmeData cipher, GpgmeData plain,
- GpgmeSigStat *r_status);
+ GpgmeData cipher, GpgmeData plain);
/* Sign the plaintext PLAIN and store the signature in SIG. Only
detached signatures are supported for now. */
GpgmeError gpgme_op_verify_start (GpgmeCtx ctx, GpgmeData sig,
GpgmeData signed_text, GpgmeData plaintext);
GpgmeError gpgme_op_verify (GpgmeCtx ctx, GpgmeData sig,
- GpgmeData signed_text, GpgmeData plaintext,
- GpgmeSigStat *r_status);
+ GpgmeData signed_text, GpgmeData plaintext);
/* Import the key in KEYDATA into the keyring. */
GpgmeError gpgme_op_import_start (GpgmeCtx ctx, GpgmeData keydata);
/*-- verify.c --*/
void _gpgme_release_verify_result (VerifyResult result);
-GpgmeSigStat _gpgme_intersect_stati (VerifyResult result);
void _gpgme_verify_status_handler (GpgmeCtx ctx, GpgmeStatusCode code,
char *args);
}
-/* Figure out a common status value for all signatures. */
-GpgmeSigStat
-_gpgme_intersect_stati (VerifyResult result)
-{
- GpgmeSigStat status = result->status;
-
- for (result = result->next; result; result = result->next)
- {
- if (status != result->status)
- return GPGME_SIG_STAT_DIFF;
- }
- return status;
-}
-
/**
* gpgme_op_verify:
* @c: the context
* @sig: the signature data
* @text: the signed text
- * @r_stat: returns the status of the signature
*
* Perform a signature check on the signature given in @sig. If @text
* is a new and uninitialized data object, it is assumed that @sig
* If @text is initialized, it is assumed that @sig is a detached
* signature for the material given in @text.
*
- * The result of this operation is returned in @r_stat which can take these
- * values:
- * GPGME_SIG_STAT_NONE: No status - should not happen
- * GPGME_SIG_STAT_GOOD: The signature is valid
- * GPGME_SIG_STAT_BAD: The signature is not valid
- * GPGME_SIG_STAT_NOKEY: The signature could not be checked due to a
- * missing key
- * GPGME_SIG_STAT_NOSIG: This is not a signature
- * GPGME_SIG_STAT_ERROR: Due to some other error the check could not be done.
- * GPGME_SIG_STAT_DIFF: There is more than 1 signature and they have not
- * the same status.
- * GPGME_SIG_STAT_GOOD_EXP: The signature is good but has expired.
- * GPGME_SIG_STAT_GOOD_KEYEXP: The signature is good but the key has expired.
- *
* Return value: 0 on success or an errorcode if something not related to
* the signature itself did go wrong.
**/
GpgmeError
gpgme_op_verify (GpgmeCtx ctx, GpgmeData sig, GpgmeData signed_text,
- GpgmeData plaintext, GpgmeSigStat *r_stat)
+ GpgmeData plaintext)
{
GpgmeError err;
- if (!r_stat)
- return mk_error (Invalid_Value);
-
gpgme_data_release (ctx->notation);
ctx->notation = NULL;
- *r_stat = GPGME_SIG_STAT_NONE;
err = _gpgme_op_verify_start (ctx, 1, sig, signed_text, plaintext);
if (!err)
- {
- err = _gpgme_wait_one (ctx);
- if (!err && ctx->result.verify)
- *r_stat = _gpgme_intersect_stati (ctx->result.verify);
- }
- return err;
+ err = _gpgme_wait_one (ctx);
+ return err;
}
* @r_created: Returns the creation timestamp
*
* Return information about an already verified signatures.
+ *
+ * The result of this operation is returned in @r_stat which can take these
+ * values:
+ * GPGME_SIG_STAT_NONE: No status - should not happen
+ * GPGME_SIG_STAT_GOOD: The signature is valid
+ * GPGME_SIG_STAT_BAD: The signature is not valid
+ * GPGME_SIG_STAT_NOKEY: The signature could not be checked due to a
+ * missing key
+ * GPGME_SIG_STAT_NOSIG: This is not a signature
+ * GPGME_SIG_STAT_ERROR: Due to some other error the check could not be done.
+ * GPGME_SIG_STAT_DIFF: There is more than 1 signature and they have not
+ * the same status.
+ * GPGME_SIG_STAT_GOOD_EXP: The signature is good but has expired.
+ * GPGME_SIG_STAT_GOOD_KEYEXP: The signature is good but the key has expired.
+ *
*
* Return value: The fingerprint or NULL in case of an problem or
* when there are no more signatures.
+2002-12-24 Marcus Brinkmann <marcus@g10code.de>
+
+ * gpgsm/t-verify.c (main): Adjust caller of gpgme_op_verify.
+ * gpg/t-verify.c (main): Likewise.
+ * gpg/t-decrypt-verify.c (main): Likewise for
+ gpgme_op_decrypt_verify.
+
2002-12-23 Marcus Brinkmann <marcus@g10code.de>
* gpgsm/Makefile.am (./gpgsm.conf): Add a faked system time to
/* t-decrypt-verify.c - regression test
- * Copyright (C) 2000 Werner Koch (dd9jn)
- * Copyright (C) 2001 g10 Code GmbH
- *
- * This file is part of GPGME.
- *
- * GPGME is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GPGME is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
+ Copyright (C) 2000 Werner Koch (dd9jn)
+ Copyright (C) 2001, 2002 g10 Code GmbH
+
+ This file is part of GPGME.
+
+ GPGME is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ GPGME is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GPGME; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <stdio.h>
#include <stdlib.h>
GpgmeData in, out, pwdata = NULL;
struct passphrase_cb_info_s info;
const char *cipher_2_asc = mk_fname ("cipher-2.asc");
- GpgmeSigStat stat;
+ GpgmeSigStat status;
char *p;
do
err = gpgme_data_new (&out);
fail_if_err (err);
- err = gpgme_op_decrypt_verify (ctx, in, out, &stat);
+ err = gpgme_op_decrypt_verify (ctx, in, out);
fail_if_err (err);
fflush (NULL);
fputs ("Begin Result:\n", stdout);
print_data (out);
fputs ("End Result.\n", stdout);
-
- if (stat != GPGME_SIG_STAT_GOOD)
+
+ if (!gpgme_get_sig_status (ctx, 0, &status, NULL))
+ {
+ fprintf (stderr, "Signature check failed unexpectedly.\n");
+ exit (1);
+ }
+ if (status != GPGME_SIG_STAT_GOOD)
{
fprintf (stderr, "Signature check failed unexpectedly.\n");
exit (1);
/* t-verify.c - regression test
- * Copyright (C) 2000 Werner Koch (dd9jn)
- * Copyright (C) 2001, 2002 g10 Code GmbH
- *
- * This file is part of GPGME.
- *
- * GPGME is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GPGME is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
+ Copyright (C) 2000 Werner Koch (dd9jn)
+ Copyright (C) 2001, 2002 g10 Code GmbH
+
+ This file is part of GPGME.
+
+ GPGME is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ GPGME is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GPGME; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <stdio.h>
#include <stdlib.h>
fail_if_err (err);
puts ("checking a valid message:\n");
- err = gpgme_op_verify (ctx, sig, text, NULL, &status);
+ err = gpgme_op_verify (ctx, sig, text, NULL);
fail_if_err (err);
+ if (!gpgme_get_sig_status (ctx, 0, &status, NULL))
+ {
+ fprintf (stderr, "%s:%d: No signature\n", __FILE__, __LINE__);
+ exit (1);
+ }
print_sig_stat (ctx, status);
if (status != GPGME_SIG_STAT_GOOD)
{
test_text1f, strlen (test_text1f), 0);
fail_if_err (err);
gpgme_data_rewind (sig);
- err = gpgme_op_verify (ctx, sig, text, NULL, &status);
+ err = gpgme_op_verify (ctx, sig, text, NULL);
fail_if_err (err);
-
+ if (!gpgme_get_sig_status (ctx, 0, &status, NULL))
+ {
+ fprintf (stderr, "%s:%d: No signature\n", __FILE__, __LINE__);
+ exit (1);
+ }
print_sig_stat (ctx, status);
if (status != GPGME_SIG_STAT_BAD)
{
fail_if_err (err);
err = gpgme_data_new (&text);
fail_if_err (err);
- err = gpgme_op_verify (ctx, sig, NULL, text, &status);
+ err = gpgme_op_verify (ctx, sig, NULL, text);
fail_if_err (err);
+ if (!gpgme_get_sig_status (ctx, 0, &status, NULL))
+ {
+ fprintf (stderr, "%s:%d: No signature\n", __FILE__, __LINE__);
+ exit (1);
+ }
nota = gpgme_data_release_and_get_mem (text, &len);
for (j = 0; j < len; j++)
/* t-verify.c - regression test
- * Copyright (C) 2000 Werner Koch (dd9jn)
- * Copyright (C) 2001, 2002 g10 Code GmbH
- *
- * This file is part of GPGME.
- *
- * GPGME is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * GPGME is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- */
+ Copyright (C) 2000 Werner Koch (dd9jn)
+ Copyright (C) 2001, 2002 g10 Code GmbH
+
+ This file is part of GPGME.
+
+ GPGME is free software; you can redistribute it and/or modify it
+ under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 2 of the License, or
+ (at your option) any later version.
+
+ GPGME is distributed in the hope that it will be useful, but
+ WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with GPGME; if not, write to the Free Software Foundation,
+ Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
#include <stdio.h>
#include <stdlib.h>
fail_if_err (err);
puts ("checking a valid message:\n");
- err = gpgme_op_verify (ctx, sig, text, NULL, &status);
- print_sig_stat (ctx, status);
- print_sig_stat (ctx, status);
- print_sig_stat (ctx, status);
- print_sig_stat (ctx, status);
+ err = gpgme_op_verify (ctx, sig, text, NULL);
fail_if_err (err);
+ if (!gpgme_get_sig_status (ctx, 0, &status, NULL))
+ {
+ fprintf (stderr, "%s:%d: No signature\n", __FILE__, __LINE__);
+ exit (1);
+ }
+ print_sig_stat (ctx, status);
if ( (nota=gpgme_get_notation (ctx)) )
printf ("---Begin Notation---\n%s---End Notation---\n", nota);
test_text1f, strlen (test_text1f), 0);
fail_if_err (err);
gpgme_data_rewind ( sig );
- err = gpgme_op_verify (ctx, sig, text, NULL, &status);
-
- print_sig_stat (ctx, status);
+ err = gpgme_op_verify (ctx, sig, text, NULL);
fail_if_err (err);
+ if (!gpgme_get_sig_status (ctx, 0, &status, NULL))
+ {
+ fprintf (stderr, "%s:%d: No signature\n", __FILE__, __LINE__);
+ exit (1);
+ }
+ print_sig_stat (ctx, status);
+
if ((nota=gpgme_get_notation (ctx)))
printf ("---Begin Notation---\n%s---End Notation---\n", nota);