1 /* decrypt-verify.c - decrypt and verify functions
2 * Copyright (C) 2000 Werner Koch (dd9jn)
3 * Copyright (C) 2001 g10 Code GmbH
5 * This file is part of GPGME.
7 * GPGME is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * GPGME is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
33 decrypt_verify_status_handler (GpgmeCtx ctx, GpgStatusCode code, char *args)
35 _gpgme_decrypt_status_handler (ctx, code, args);
36 _gpgme_verify_status_handler (ctx, code, args);
40 gpgme_op_decrypt_verify_start (GpgmeCtx ctx, GpgmeData ciph, GpgmeData plain)
42 return _gpgme_decrypt_start (ctx, ciph, plain,
43 decrypt_verify_status_handler);
47 * gpgme_op_decrypt_verify:
49 * @in: ciphertext input
50 * @out: plaintext output
52 * This function decrypts @in to @out and performs a signature check.
53 * Other parameters are take from the context @c.
54 * The function does wait for the result.
56 * Return value: 0 on success or an errorcode.
59 gpgme_op_decrypt_verify (GpgmeCtx ctx,
60 GpgmeData in, GpgmeData out,
63 GpgmeError err = gpgme_op_decrypt_verify_start (ctx, in, out);
67 if (!ctx->result.decrypt || !ctx->result.verify)
68 err = mk_error (General_Error);
69 else if (ctx->out_of_core)
70 err = mk_error (Out_Of_Core);
73 err = _gpgme_decrypt_result (ctx);
75 *r_stat = _gpgme_intersect_stati (ctx->result.verify);