gpgme/tests/gpg/t-encrypt.c

86 lines
2.3 KiB
C
Raw Permalink Normal View History

/* t-encrypt.c - Regression test.
* Copyright (C) 2000 Werner Koch (dd9jn)
* Copyright (C) 2001, 2002, 2003, 2004 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 Lesser General Public License as
* published by the Free Software Foundation; either version 2.1 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
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this program; if not, see <https://gnu.org/licenses/>.
* SPDX-License-Identifier: LGPL-2.1-or-later
*/
2000-11-07 13:32:38 +00:00
/* We need to include config.h so that we know whether we are building
with large file system (LFS) support. */
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
2000-11-07 13:32:38 +00:00
#include <stdlib.h>
#include <stdio.h>
2000-11-07 13:32:38 +00:00
#include <string.h>
#include <gpgme.h>
2000-11-07 13:32:38 +00:00
#include "t-support.h"
2000-11-09 16:35:35 +00:00
int
main (int argc, char *argv[])
2000-11-07 13:32:38 +00:00
{
2003-05-18 Marcus Brinkmann <marcus@g10code.de> In all files, replace the Gpgme* type names with the new gpgme_* type names. doc/ 2003-05-18 Marcus Brinkmann <marcus@g10code.de> * gpgme.texi (Header): Remove Gpgme as namespace prefix. Add _GPGME to namespace prefix. * gpgme.texi (Multi Threading): Add note about link order. gpgme/ 2003-05-18 Marcus Brinkmann <marcus@g10code.de> * gpgme.h: The following types are renamed. The old name is kept as a deprecated typedef. (GpgmeCtx): Rename to gpgme_ctx_t. (GpgmeData): Rename to gpgme_data_t. (GpgmeRecipients): Rename to gpgme_recipients_t. (GpgmeError): Rename to gpgme_error_t. (GpgmeDataEncoding): Rename to gpgme_data_encoding_t. (GpgmePubKeyAlgo): Rename to gpgme_pubkey_algo_t. (GpgmeHashAlgo): Rename to gpgme_hash_algo_t. (GpgmeSigStat): Rename to gpgme_sig_stat_t. (GpgmeSigMode): Rename to gpgme_sig_mode_t. (GpgmeAttr): Rename to gpgme_attr_t. (GpgmeValidity): Rename to gpgme_validity_t. (GpgmeProtocol): Rename to gpgme_protocol_t. (GpgmeStatusCode): Rename to gpgme_status_code_t. (GpgmeEngineInfo): Rename to gpgme_engine_info_t. (GpgmeSubkey): Rename to gpgme_subkey_t. (GpgmeKeySig): Rename to gpgme_keysig_t. (GpgmeUserID): Rename to gpgme_user_id_t. (GpgmePassphraseCb): Rename to gpgme_passphrase_cb_t. (GpgmeProgressCb): Rename to gpgme_progress_cb_t. (GpgmeEditCb): Rename to gpgme_edit_cb_t. (GpgmeIOCb): Rename to gpgme_io_cb_t. (GpgmeRegisterIOCb): Rename to gpgme_register_io_cb_t. (GpgmeRemoveIOCb): Rename to gpgme_remove_io_cb_t. (GpgmeEventIO): Rename to gpgme_event_io_t. (GpgmeEventIOCb): Rename to gpgme_event_io_cb_t. (GpgmeIOCbs): Rename to gpgme_io_cbs. (gpgme_io_cbs_t): New type. (GpgmeDataReadCb): Rename to gpgme_data_read_cb_t. (GpgmeDataWriteCb): Rename to gpgme_data_write_cb_t. (GpgmeDataSeekCb): Rename to gpgme_data_seek_cb_t. (GpgmeDataReleaseCb): Rename to gpgme_data_release_cb_t. (GpgmeDataCbs): Rename to gpgme_data_cbs. (gpgme_data_cbs_t): New type. (GpgmeInvalidUserID): Rename to gpgme_invalid_user_id_t. (GpgmeEncryptResult): Rename to gpgme_encrypt_result_t. (GpgmeDecryptResult): Rename to gpgme_decrypt_result_t. (GpgmeNewSignature): Rename to gpgme_new_signature_t. (GpgmeSignResult): Rename to gpgme_sign_result_t. (GpgmeSigNotation): Rename to gpgme_sig_notation_t. (GpgmeSignature): Rename to gpgme_signature_t. (GpgmeVerifyResult): Rename to gpgme_verify_result_t. (GpgmeImportStatus): Rename to gpgme_import_status_t. (GpgmeImportResult): Rename to gpgme_import_result_t. (GpgmeGenKeyResult): Rename to gpgme_genkey_result_t. (GpgmeKeyListResult): Rename to gpgme_keylist_result_t. (GpgmeTrustItem): Rename to gpgme_trust_item_t. * gpgme.h (gpgme_deprecated_error_t): New type, swallowing macros GPGME_No_Recipients, GPGME_Invalid_Recipient and GPGME_No_Passphrase. * data.h (struct gpgme_data_s): Rename to struct gpgme_data. * context.h (struct gpgme_context_s): Rename to struct gpgme_context. (struct gpgme_recipients_s): Rename to gpgme_recipients.
2003-05-18 20:45:24 +00:00
gpgme_ctx_t ctx;
gpgme_error_t err;
gpgme_data_t in, out;
doc/ 2003-05-29 Marcus Brinkmann <marcus@g10code.de> * gpgme.texi (Exporting Keys): Change and document prototypes. Add new gpgme_op_export_ext and gpgme_op_export_ext_start variants. (Selecting Recipients): Section removed. (Encrypting a Plaintext): Change prototypes and document the changes. gpgme/ 2003-05-29 Marcus Brinkmann <marcus@g10code.de> * gpgme.h (gpgme_op_export_start): Change second arg to const char *. (gpgme_op_export): Likewise. (gpgme_op_export_ext_start): New prototype. (gpgme_op_export_ext): Likewise. * engine.h: Likewise for _gpgme_engine_op_export and _gpgme_engine_op_export_ext. * engine-backend.h (struct engine_ops): Change second argument of prototype of export to const char *, and add reserverd int as third argument. Add prototype for export_ext. * engine.c (_gpgme_engine_op_export_ext): New function. (_gpgme_engine_op_export): Change second argument of prototype of export to const char *, and add reserverd int as third argument. * rungpg.c (gpg_export): Change second argument of prototype of export to const char *, and add reserverd int as third argument. (gpg_export_ext): New function. (gpg_keylist_ext): Break loop at error. (_gpgme_engine_ops_gpg): Add gpg_export_ext. * engine-gpgsm.c (gpgsm_export): Change second argument of prototype of export to const char *, and add reserverd int as third argument. (gpgsm_export_ext): New function. (_gpgme_engine_ops_gpgsm): Add gpgsm_export_ext. * export.c (export_start): Change second argument of prototype of export to const char *, and add reserverd int as third argument. (gpgme_op_export_start): Likewise. (export_ext_start): New function. (gpgme_op_export_ext_start): Likewise. (gpgme_op_export_ext): Likewise. * gpgme.h (gpgme_keylist_mode_t): New type for anonymous enum. (gpgme_sigsum_t): New type for anonymous enum. * encrypt-sign.c (encrypt_sign_start): Check for errors earlier, and return an error if RECP is not set. * Makefile.am (libgpgme_la_SOURCES): Remove user-id.c. * user-id.c: Remove file. * ops.h: Remove prototype for _gpgme_user_ids_all_valid. * gpgme.h (gpgme_encrypt_flags_t): New type. (gpgme_op_encrypt_start): Change second parameter to type gpgme_key_t[], and add third parameter. (gpgme_op_encrypt): Likewise. (gpgme_op_encrypt_sign_start): Likewise. (gpgme_op_encrypt_sign): Likewise. * encrypt.c (encrypt_start): Likewise. (gpgme_op_encrypt_start): Likewise. (gpgme_op_encrypt): Likewise. Pass flags to engine. * encrypt-sign.c (encrypt_sign_start): Likewise. (gpgme_op_encrypt_sign_start): Likewise. (gpgme_op_encrypt_sign): Likewise. * engine-backend.h (struct engine_ops): Likewise for prototypes of encrypt and encrypt_sign. * engine.h: Likewise for prototypes of _gpgme_engine_op_encrypt and _gpgme_engine_op_encrypt_sign. * engine.c (_gpgme_engine_op_encrypt): Likewise. (_gpgme_engine_op_encrypt_sign): Likewise. * rungpg.c (gpg_encrypt): Likewise. (gpg_encrypt_sign): Likewise. * rungpg.c (gpg_encrypt): Check flags for always trust option. * engine-gpgsm.c (gpgsm_encrypt): Likewise. (set_recipients): Rewritten to use keys instead user IDs. * rungpg.c (append_args_from_recipients): Rewritten to use keys instead user IDs. * encrypt.c (_gpgme_encrypt_status_handler): Change errors returned to GPGME_Invalid_Key and GPGME_General_Error. tests/ 2003-05-29 Marcus Brinkmann <marcus@g10code.de> * gpg/t-encrypt-sym.c (main): Adapt to new syntax. * gpg/t-encrypt.c (main): Likewise. * gpg/t-eventloop.c (main): Likewise. * gpg/t-encrypt-sign.c (main): Likewise. * gpgsm/t-export.c (main): Likewise. * gpgsm/t-encrypt.c (main): Likewise.
2003-05-29 03:21:02 +00:00
gpgme_key_t key[3] = { NULL, NULL, NULL };
2003-05-18 Marcus Brinkmann <marcus@g10code.de> In all files, replace the Gpgme* type names with the new gpgme_* type names. doc/ 2003-05-18 Marcus Brinkmann <marcus@g10code.de> * gpgme.texi (Header): Remove Gpgme as namespace prefix. Add _GPGME to namespace prefix. * gpgme.texi (Multi Threading): Add note about link order. gpgme/ 2003-05-18 Marcus Brinkmann <marcus@g10code.de> * gpgme.h: The following types are renamed. The old name is kept as a deprecated typedef. (GpgmeCtx): Rename to gpgme_ctx_t. (GpgmeData): Rename to gpgme_data_t. (GpgmeRecipients): Rename to gpgme_recipients_t. (GpgmeError): Rename to gpgme_error_t. (GpgmeDataEncoding): Rename to gpgme_data_encoding_t. (GpgmePubKeyAlgo): Rename to gpgme_pubkey_algo_t. (GpgmeHashAlgo): Rename to gpgme_hash_algo_t. (GpgmeSigStat): Rename to gpgme_sig_stat_t. (GpgmeSigMode): Rename to gpgme_sig_mode_t. (GpgmeAttr): Rename to gpgme_attr_t. (GpgmeValidity): Rename to gpgme_validity_t. (GpgmeProtocol): Rename to gpgme_protocol_t. (GpgmeStatusCode): Rename to gpgme_status_code_t. (GpgmeEngineInfo): Rename to gpgme_engine_info_t. (GpgmeSubkey): Rename to gpgme_subkey_t. (GpgmeKeySig): Rename to gpgme_keysig_t. (GpgmeUserID): Rename to gpgme_user_id_t. (GpgmePassphraseCb): Rename to gpgme_passphrase_cb_t. (GpgmeProgressCb): Rename to gpgme_progress_cb_t. (GpgmeEditCb): Rename to gpgme_edit_cb_t. (GpgmeIOCb): Rename to gpgme_io_cb_t. (GpgmeRegisterIOCb): Rename to gpgme_register_io_cb_t. (GpgmeRemoveIOCb): Rename to gpgme_remove_io_cb_t. (GpgmeEventIO): Rename to gpgme_event_io_t. (GpgmeEventIOCb): Rename to gpgme_event_io_cb_t. (GpgmeIOCbs): Rename to gpgme_io_cbs. (gpgme_io_cbs_t): New type. (GpgmeDataReadCb): Rename to gpgme_data_read_cb_t. (GpgmeDataWriteCb): Rename to gpgme_data_write_cb_t. (GpgmeDataSeekCb): Rename to gpgme_data_seek_cb_t. (GpgmeDataReleaseCb): Rename to gpgme_data_release_cb_t. (GpgmeDataCbs): Rename to gpgme_data_cbs. (gpgme_data_cbs_t): New type. (GpgmeInvalidUserID): Rename to gpgme_invalid_user_id_t. (GpgmeEncryptResult): Rename to gpgme_encrypt_result_t. (GpgmeDecryptResult): Rename to gpgme_decrypt_result_t. (GpgmeNewSignature): Rename to gpgme_new_signature_t. (GpgmeSignResult): Rename to gpgme_sign_result_t. (GpgmeSigNotation): Rename to gpgme_sig_notation_t. (GpgmeSignature): Rename to gpgme_signature_t. (GpgmeVerifyResult): Rename to gpgme_verify_result_t. (GpgmeImportStatus): Rename to gpgme_import_status_t. (GpgmeImportResult): Rename to gpgme_import_result_t. (GpgmeGenKeyResult): Rename to gpgme_genkey_result_t. (GpgmeKeyListResult): Rename to gpgme_keylist_result_t. (GpgmeTrustItem): Rename to gpgme_trust_item_t. * gpgme.h (gpgme_deprecated_error_t): New type, swallowing macros GPGME_No_Recipients, GPGME_Invalid_Recipient and GPGME_No_Passphrase. * data.h (struct gpgme_data_s): Rename to struct gpgme_data. * context.h (struct gpgme_context_s): Rename to struct gpgme_context. (struct gpgme_recipients_s): Rename to gpgme_recipients.
2003-05-18 20:45:24 +00:00
gpgme_encrypt_result_t result;
(void)argc;
(void)argv;
init_gpgme (GPGME_PROTOCOL_OpenPGP);
err = gpgme_new (&ctx);
fail_if_err (err);
gpgme_set_armor (ctx, 1);
err = gpgme_data_new_from_mem (&in, "Hallo Leute\n", 12, 0);
fail_if_err (err);
err = gpgme_data_new (&out);
fail_if_err (err);
doc/ 2003-05-28 Marcus Brinkmann <marcus@g10code.de> * gpgme.texi (Exporting Keys): Change argument type from gpgme_recipient_t to gpgme_user_id_t. (Encrypting a Plaintext): Likewise. (Selecting Recipients): Rewritten. gpgme/ 2003-05-28 Marcus Brinkmann <marcus@g10code.de> * Makefile.am (libgpgme_la_SOURCES): Remove recipient.c, add user-id.c. * gpgme.h (gpgme_recipients_t): Removed. (gpgme_recipients_new, gpgme_recipients_release, gpgme_recipients_add_name, gpgme_recipients_add_name_with_validity, gpgme_recipients_count, gpgme_recipients_enum_open, gpgme_recipients_enum_read, gpgme_recipients_enum_close): Removed. (gpgme_op_encrypt, gpgme_op_encrypt_start, gpgme_op_encrypt_sign, gpgme_op_encrypt_sign_start, gpgme_op_export_start, gpgme_op_export): Change second argument to gpgme_user_id_t. (gpgme_user_ids_release): New prototype. (gpgme_user_ids_append): Likewise. * ops.h (_gpgme_recipients_all_valid): Remove. (_gpgme_user_ids_all_valid): Add. * context.h (struct gpgme_recipients): Removed. * user-id.c: New file. * recipient.c: Removed file. * rungpg.c (append_args_from_recipients): Change last arg to gpgme_user_id_t. Reimplement. (gpg_encrypt): Change second arg to gpgme_user_id_t. (gpg_encrypt_sign): Likewise. (gpg_export): Likewise. Rewrite user ID list code. * engine.c (_gpgme_engine_op_encrypt): Change second arg to gpgme_user_id_t. (_gpgme_engine_op_encrypt_sign): Likewise. (_gpgme_engine_op_export): Likewise. * engine.h (_gpgme_engine_op_encrypt, _gpgme_engine_op_encrypt_sign, _gpgme_engine_op_export): Likewise. * engine-gpgsm.c (set_recipients): Likewise. Rewrite loop code. (gpgsm_encrypt): Likewise. (gpgsm_export): Likewise. * engine-backend.h (struct engine_ops): Likewise for members ENCRYPT, ENCRYPT_SIGN and EXPORT. * export.c (export_start, gpgme_op_export_start, gpgme_op_export): Likewise. * encrypt.c (encrypt_start): Likewise. Don't check for count of recipients. (gpgme_op_encrypt_start): Likewise. (gpgme_op_encrypt): Likewise. * encrypt-sign.c (encrypt_sign_start): Likewise. (gpgme_op_encrypt_sign): Likewise. (gpgme_op_encrypt_sign_start): Likewise. tests/ 2003-05-28 Marcus Brinkmann <marcus@g10code.de> * gpg/t-eventloop.c (main): Rewrite recipient management. * gpg/t-encrypt-sign.c (main): Likewise. * gpg/t-encrypt.c (main): Likewise. * gpg/t-export.c (main): Likewise.
2003-05-28 01:15:38 +00:00
doc/ 2003-05-29 Marcus Brinkmann <marcus@g10code.de> * gpgme.texi (Exporting Keys): Change and document prototypes. Add new gpgme_op_export_ext and gpgme_op_export_ext_start variants. (Selecting Recipients): Section removed. (Encrypting a Plaintext): Change prototypes and document the changes. gpgme/ 2003-05-29 Marcus Brinkmann <marcus@g10code.de> * gpgme.h (gpgme_op_export_start): Change second arg to const char *. (gpgme_op_export): Likewise. (gpgme_op_export_ext_start): New prototype. (gpgme_op_export_ext): Likewise. * engine.h: Likewise for _gpgme_engine_op_export and _gpgme_engine_op_export_ext. * engine-backend.h (struct engine_ops): Change second argument of prototype of export to const char *, and add reserverd int as third argument. Add prototype for export_ext. * engine.c (_gpgme_engine_op_export_ext): New function. (_gpgme_engine_op_export): Change second argument of prototype of export to const char *, and add reserverd int as third argument. * rungpg.c (gpg_export): Change second argument of prototype of export to const char *, and add reserverd int as third argument. (gpg_export_ext): New function. (gpg_keylist_ext): Break loop at error. (_gpgme_engine_ops_gpg): Add gpg_export_ext. * engine-gpgsm.c (gpgsm_export): Change second argument of prototype of export to const char *, and add reserverd int as third argument. (gpgsm_export_ext): New function. (_gpgme_engine_ops_gpgsm): Add gpgsm_export_ext. * export.c (export_start): Change second argument of prototype of export to const char *, and add reserverd int as third argument. (gpgme_op_export_start): Likewise. (export_ext_start): New function. (gpgme_op_export_ext_start): Likewise. (gpgme_op_export_ext): Likewise. * gpgme.h (gpgme_keylist_mode_t): New type for anonymous enum. (gpgme_sigsum_t): New type for anonymous enum. * encrypt-sign.c (encrypt_sign_start): Check for errors earlier, and return an error if RECP is not set. * Makefile.am (libgpgme_la_SOURCES): Remove user-id.c. * user-id.c: Remove file. * ops.h: Remove prototype for _gpgme_user_ids_all_valid. * gpgme.h (gpgme_encrypt_flags_t): New type. (gpgme_op_encrypt_start): Change second parameter to type gpgme_key_t[], and add third parameter. (gpgme_op_encrypt): Likewise. (gpgme_op_encrypt_sign_start): Likewise. (gpgme_op_encrypt_sign): Likewise. * encrypt.c (encrypt_start): Likewise. (gpgme_op_encrypt_start): Likewise. (gpgme_op_encrypt): Likewise. Pass flags to engine. * encrypt-sign.c (encrypt_sign_start): Likewise. (gpgme_op_encrypt_sign_start): Likewise. (gpgme_op_encrypt_sign): Likewise. * engine-backend.h (struct engine_ops): Likewise for prototypes of encrypt and encrypt_sign. * engine.h: Likewise for prototypes of _gpgme_engine_op_encrypt and _gpgme_engine_op_encrypt_sign. * engine.c (_gpgme_engine_op_encrypt): Likewise. (_gpgme_engine_op_encrypt_sign): Likewise. * rungpg.c (gpg_encrypt): Likewise. (gpg_encrypt_sign): Likewise. * rungpg.c (gpg_encrypt): Check flags for always trust option. * engine-gpgsm.c (gpgsm_encrypt): Likewise. (set_recipients): Rewritten to use keys instead user IDs. * rungpg.c (append_args_from_recipients): Rewritten to use keys instead user IDs. * encrypt.c (_gpgme_encrypt_status_handler): Change errors returned to GPGME_Invalid_Key and GPGME_General_Error. tests/ 2003-05-29 Marcus Brinkmann <marcus@g10code.de> * gpg/t-encrypt-sym.c (main): Adapt to new syntax. * gpg/t-encrypt.c (main): Likewise. * gpg/t-eventloop.c (main): Likewise. * gpg/t-encrypt-sign.c (main): Likewise. * gpgsm/t-export.c (main): Likewise. * gpgsm/t-encrypt.c (main): Likewise.
2003-05-29 03:21:02 +00:00
err = gpgme_get_key (ctx, "A0FF4590BB6122EDEF6E3C542D727CC768697734",
&key[0], 0);
fail_if_err (err);
err = gpgme_get_key (ctx, "D695676BDCEDCC2CDD6152BCFE180B1DA9E3B0B2",
&key[1], 0);
fail_if_err (err);
doc/ 2003-05-29 Marcus Brinkmann <marcus@g10code.de> * gpgme.texi (Exporting Keys): Change and document prototypes. Add new gpgme_op_export_ext and gpgme_op_export_ext_start variants. (Selecting Recipients): Section removed. (Encrypting a Plaintext): Change prototypes and document the changes. gpgme/ 2003-05-29 Marcus Brinkmann <marcus@g10code.de> * gpgme.h (gpgme_op_export_start): Change second arg to const char *. (gpgme_op_export): Likewise. (gpgme_op_export_ext_start): New prototype. (gpgme_op_export_ext): Likewise. * engine.h: Likewise for _gpgme_engine_op_export and _gpgme_engine_op_export_ext. * engine-backend.h (struct engine_ops): Change second argument of prototype of export to const char *, and add reserverd int as third argument. Add prototype for export_ext. * engine.c (_gpgme_engine_op_export_ext): New function. (_gpgme_engine_op_export): Change second argument of prototype of export to const char *, and add reserverd int as third argument. * rungpg.c (gpg_export): Change second argument of prototype of export to const char *, and add reserverd int as third argument. (gpg_export_ext): New function. (gpg_keylist_ext): Break loop at error. (_gpgme_engine_ops_gpg): Add gpg_export_ext. * engine-gpgsm.c (gpgsm_export): Change second argument of prototype of export to const char *, and add reserverd int as third argument. (gpgsm_export_ext): New function. (_gpgme_engine_ops_gpgsm): Add gpgsm_export_ext. * export.c (export_start): Change second argument of prototype of export to const char *, and add reserverd int as third argument. (gpgme_op_export_start): Likewise. (export_ext_start): New function. (gpgme_op_export_ext_start): Likewise. (gpgme_op_export_ext): Likewise. * gpgme.h (gpgme_keylist_mode_t): New type for anonymous enum. (gpgme_sigsum_t): New type for anonymous enum. * encrypt-sign.c (encrypt_sign_start): Check for errors earlier, and return an error if RECP is not set. * Makefile.am (libgpgme_la_SOURCES): Remove user-id.c. * user-id.c: Remove file. * ops.h: Remove prototype for _gpgme_user_ids_all_valid. * gpgme.h (gpgme_encrypt_flags_t): New type. (gpgme_op_encrypt_start): Change second parameter to type gpgme_key_t[], and add third parameter. (gpgme_op_encrypt): Likewise. (gpgme_op_encrypt_sign_start): Likewise. (gpgme_op_encrypt_sign): Likewise. * encrypt.c (encrypt_start): Likewise. (gpgme_op_encrypt_start): Likewise. (gpgme_op_encrypt): Likewise. Pass flags to engine. * encrypt-sign.c (encrypt_sign_start): Likewise. (gpgme_op_encrypt_sign_start): Likewise. (gpgme_op_encrypt_sign): Likewise. * engine-backend.h (struct engine_ops): Likewise for prototypes of encrypt and encrypt_sign. * engine.h: Likewise for prototypes of _gpgme_engine_op_encrypt and _gpgme_engine_op_encrypt_sign. * engine.c (_gpgme_engine_op_encrypt): Likewise. (_gpgme_engine_op_encrypt_sign): Likewise. * rungpg.c (gpg_encrypt): Likewise. (gpg_encrypt_sign): Likewise. * rungpg.c (gpg_encrypt): Check flags for always trust option. * engine-gpgsm.c (gpgsm_encrypt): Likewise. (set_recipients): Rewritten to use keys instead user IDs. * rungpg.c (append_args_from_recipients): Rewritten to use keys instead user IDs. * encrypt.c (_gpgme_encrypt_status_handler): Change errors returned to GPGME_Invalid_Key and GPGME_General_Error. tests/ 2003-05-29 Marcus Brinkmann <marcus@g10code.de> * gpg/t-encrypt-sym.c (main): Adapt to new syntax. * gpg/t-encrypt.c (main): Likewise. * gpg/t-eventloop.c (main): Likewise. * gpg/t-encrypt-sign.c (main): Likewise. * gpgsm/t-export.c (main): Likewise. * gpgsm/t-encrypt.c (main): Likewise.
2003-05-29 03:21:02 +00:00
err = gpgme_op_encrypt (ctx, key, GPGME_ENCRYPT_ALWAYS_TRUST, in, out);
fail_if_err (err);
result = gpgme_op_encrypt_result (ctx);
if (result->invalid_recipients)
{
fprintf (stderr, "Invalid recipient encountered: %s\n",
result->invalid_recipients->fpr);
exit (1);
}
print_data (out);
2000-11-07 13:32:38 +00:00
doc/ 2003-05-29 Marcus Brinkmann <marcus@g10code.de> * gpgme.texi (Exporting Keys): Change and document prototypes. Add new gpgme_op_export_ext and gpgme_op_export_ext_start variants. (Selecting Recipients): Section removed. (Encrypting a Plaintext): Change prototypes and document the changes. gpgme/ 2003-05-29 Marcus Brinkmann <marcus@g10code.de> * gpgme.h (gpgme_op_export_start): Change second arg to const char *. (gpgme_op_export): Likewise. (gpgme_op_export_ext_start): New prototype. (gpgme_op_export_ext): Likewise. * engine.h: Likewise for _gpgme_engine_op_export and _gpgme_engine_op_export_ext. * engine-backend.h (struct engine_ops): Change second argument of prototype of export to const char *, and add reserverd int as third argument. Add prototype for export_ext. * engine.c (_gpgme_engine_op_export_ext): New function. (_gpgme_engine_op_export): Change second argument of prototype of export to const char *, and add reserverd int as third argument. * rungpg.c (gpg_export): Change second argument of prototype of export to const char *, and add reserverd int as third argument. (gpg_export_ext): New function. (gpg_keylist_ext): Break loop at error. (_gpgme_engine_ops_gpg): Add gpg_export_ext. * engine-gpgsm.c (gpgsm_export): Change second argument of prototype of export to const char *, and add reserverd int as third argument. (gpgsm_export_ext): New function. (_gpgme_engine_ops_gpgsm): Add gpgsm_export_ext. * export.c (export_start): Change second argument of prototype of export to const char *, and add reserverd int as third argument. (gpgme_op_export_start): Likewise. (export_ext_start): New function. (gpgme_op_export_ext_start): Likewise. (gpgme_op_export_ext): Likewise. * gpgme.h (gpgme_keylist_mode_t): New type for anonymous enum. (gpgme_sigsum_t): New type for anonymous enum. * encrypt-sign.c (encrypt_sign_start): Check for errors earlier, and return an error if RECP is not set. * Makefile.am (libgpgme_la_SOURCES): Remove user-id.c. * user-id.c: Remove file. * ops.h: Remove prototype for _gpgme_user_ids_all_valid. * gpgme.h (gpgme_encrypt_flags_t): New type. (gpgme_op_encrypt_start): Change second parameter to type gpgme_key_t[], and add third parameter. (gpgme_op_encrypt): Likewise. (gpgme_op_encrypt_sign_start): Likewise. (gpgme_op_encrypt_sign): Likewise. * encrypt.c (encrypt_start): Likewise. (gpgme_op_encrypt_start): Likewise. (gpgme_op_encrypt): Likewise. Pass flags to engine. * encrypt-sign.c (encrypt_sign_start): Likewise. (gpgme_op_encrypt_sign_start): Likewise. (gpgme_op_encrypt_sign): Likewise. * engine-backend.h (struct engine_ops): Likewise for prototypes of encrypt and encrypt_sign. * engine.h: Likewise for prototypes of _gpgme_engine_op_encrypt and _gpgme_engine_op_encrypt_sign. * engine.c (_gpgme_engine_op_encrypt): Likewise. (_gpgme_engine_op_encrypt_sign): Likewise. * rungpg.c (gpg_encrypt): Likewise. (gpg_encrypt_sign): Likewise. * rungpg.c (gpg_encrypt): Check flags for always trust option. * engine-gpgsm.c (gpgsm_encrypt): Likewise. (set_recipients): Rewritten to use keys instead user IDs. * rungpg.c (append_args_from_recipients): Rewritten to use keys instead user IDs. * encrypt.c (_gpgme_encrypt_status_handler): Change errors returned to GPGME_Invalid_Key and GPGME_General_Error. tests/ 2003-05-29 Marcus Brinkmann <marcus@g10code.de> * gpg/t-encrypt-sym.c (main): Adapt to new syntax. * gpg/t-encrypt.c (main): Likewise. * gpg/t-eventloop.c (main): Likewise. * gpg/t-encrypt-sign.c (main): Likewise. * gpgsm/t-export.c (main): Likewise. * gpgsm/t-encrypt.c (main): Likewise.
2003-05-29 03:21:02 +00:00
gpgme_key_unref (key[0]);
gpgme_key_unref (key[1]);
gpgme_data_release (in);
gpgme_data_release (out);
gpgme_release (ctx);
return 0;
2000-11-07 13:32:38 +00:00
}