aboutsummaryrefslogtreecommitdiffstats
path: root/src/gpgme-tool.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* core: Support all keylist modes and fix possible overrunIngo Klöcker2024-07-151-3/+17
| | | | | | | | | | | | | | * src/gpgme-tool.c (gt_get_keylist_mode): Increase NR_KEYLIST_MODES to number of keylist modes. Add support for GPGME_KEYLIST_MODE_WITH_TOFU, GPGME_KEYLIST_MODE_WITH_KEYGRIP, GPGME_KEYLIST_MODE_WITH_V5FPR. Write all modes. (hlp_keylist_mode): List all supported keylist modes. (cmd_keylist_mode): Add support for GPGME_KEYLIST_MODE_WITH_TOFU, GPGME_KEYLIST_MODE_WITH_KEYGRIP, GPGME_KEYLIST_MODE_WITH_V5FPR. -- This fixes the possible overrun reported by Michal Hlavinka and adds support for all keylist modes.
* gpgme-tool: Support use of Windows HANDLE for INPUT/OUTPUT/MESSAGE.NIIBE Yutaka2023-09-291-1/+13
| | | | | | | | | | * src/gpgme-tool.c [HAVE_W32_SYSTEM] (server_data_obj): Implement for Windows HANDLE. -- GnuPG-bug-id: 6634 Signed-off-by: NIIBE Yutaka <[email protected]>
* core: Support --locate-external-keys command of gpgIngo Klöcker2022-04-271-0/+4
| | | | | | | | | | | | | | * src/gpgme.h.in (GPGME_KEYLIST_MODE_FORCE_EXTERN): New. (GPGME_KEYLIST_MODE_LOCATE_EXTERNAL): New. * src/gpgme.c (gpgme_set_keylist_mode): Check for invalid mode. * src/engine-gpg.c (gpg_keylist_build_options): Use "--locate-external-keys" instead of "--locate-keys" if flag is set. * src/gpgme-json.c (op_keylist): New flag "force-extern". * src/gpgme-tool.c (gt_get_keylist_mode, cmd_keylist_mode): Handle new mode. -- GnuPG-bug-id: 5951
* core: Add new option --secret-subkey to help texts.Ingo Klöcker2022-01-041-1/+2
| | | | | | | | * src/gpgme-tool.c (hlp_export): Add new option. * tests/run-export.c (show_usage): Print new option. -- GnuPG-bug-id: 5757
* core: New export mode to export secret subkeys.Ingo Klöcker2022-01-041-0/+2
| | | | | | | | | | | | | | | | | | | * src/gpgme.h.in (GPGME_EXPORT_MODE_SECRET_SUBKEY): New. * src/export.c (check_mode): Allow new mode and check for invalid combinations. (export_keys_start): Return error if new mode flag is set. * src/engine-gpg.c (export_common): Implement. * src/gpgme-tool.c (cmd_export): New option --secret-subkey. * tests/run-export.c (main): New option --secret-subkey. -- This adds support for exporting secret subkeys (via gpg's --export-secret-subkeys) to gpgme_op_export[_ext][_start]. The flag is not supported by gpgme_op_export_keys[_start] because there is no way to specify which subkey(s) to export with these functions. GnuPG-bug-id: 5757
* gpgme-tool: Fix help text for INCLUDE_CERTS.Daniel Kahn Gillmor2019-12-031-1/+1
| | | | | | * src/gpgme-tool.c (hlp_include_certs): added missing newline. Signed-off-by: Daniel Kahn Gillmor <[email protected]>
* Add SPDX identifiers to most source filesWerner Koch2018-11-161-17/+18
| | | | | | -- Signed-off-by: Werner Koch <[email protected]>
* w32: Remove all support for WindowsCEWerner Koch2018-10-311-12/+3
| | | | | | | | | | | | | | | | | | | | | | | | | * configure.ac: Remove WindwosCE support. * contrib/: Remove all; it was only used for WindowsCE. * src/w32-ce.c, src/w32-ce.h: Remove files. * src/Makefile.am (system_components): Remove these files. * src/ath.c, src/ath.h: Remove W32CE support. * src/data-compat.c (gpgme_data_new_from_filepart): Ditto. (gpgme_data_new_from_file): Ditto. * src/debug.c (debug_init, _gpgme_debug): Ditto. * src/gpgme-tool.c (gpgme_server): Ditto. (main): Ditto. * src/priv-io.h: Do not include w32-ce.h. * src/util.h: Remove WindowsCE support. * src/w32-io.c: Ditto. * src/w32-util.c: Ditto. * src/debug.h (TRACE_SUC4): New. -- There is no more hardware to test our code, the support for Windows CE terminated along time ago. Note that our code worked only with the old WindowsCE with that overall system limit of 31 processes. Signed-off-by: Werner Koch <[email protected]>
* IDENTIFYBen McGinnes2018-03-041-1/+1
| | | | * Fixed sp error in docstring.
* doc: Replace http: by https: in core source files.Werner Koch2016-11-161-1/+1
| | | | | | -- Signed-off-by: Werner Koch <[email protected]>
* core: Use const char * where appropriate.Werner Koch2016-09-131-14/+18
| | | | Signed-off-by: Werner Koch <[email protected]>
* core: Mark unused function args.Werner Koch2016-09-131-0/+18
| | | | Signed-off-by: Werner Koch <[email protected]>
* core: Do not pass const char* to functions taking a char*.Werner Koch2016-09-131-2/+3
| | | | Signed-off-by: Werner Koch <[email protected]>
* Fix including nil bytes in keylist output.Ben Kibbey2016-07-191-6/+6
| | | | | | * src/gpgme-tool.c (cmd_keylist,gt_result): use strlen(). Signed-off-by: Ben Kibbey <[email protected]>
* core: New GPGME_DATA_ENCODING_MIME.Werner Koch2016-07-131-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | * src/gpgme.h.in (GPGME_DATA_ENCODING_MIME): New. * src/data.c (gpgme_data_set_encoding): Adjust check. * src/engine-gpg.c (have_gpg_version): New. (gpg_encrypt, gpg_encrypt_sign): Pass flag '--mimemode'. (gpg_sign): Ditto. * lang/cpp/src/data.h (GpgME): Add MimeEncoding. * lang/cpp/src/data.cpp (encoding, setEncoding): Support MimeEncoding. * src/gpgme-tool.c (server_data_encoding): Add flag --mime. -- This feature allows an application to declare that the encrypted or signed data is a valid MIME part. What is missing is a way to return that information to the application after decryption/verification. This can be done by setting the encoding of the output data object; however this requires some internal additions to our processing model. Signed-off-by: Werner Koch <[email protected]>
* tests: Add new test tool run-identify.Werner Koch2016-06-211-0/+2
| | | | | | | | * src/gpgme-tool.c (gt_identify): Add new strings. * tests/run-identify.c: New. * tests/Makefile.am (noinst_PROGRAMS): Add run-identify. Signed-off-by: Werner Koch <[email protected]>
* gpgme-tool: Switch to argparse.c for option parsing.Werner Koch2015-08-311-491/+49
| | | | | | | | | | | | | | * src/argparse.c, src/argparse.h: New. Taken from current gnupg. * src/Makefile.am (gpgme_tool_SOURCES): New. * src/gpgme-tool.c: Remove all argp.h stuff. (my_strusage): New. (main): Change to use argparse. -- As a GnuPG related tool the user should get the same experience in option parsing as with gpg et al. Thus we use the same parser. Signed-off-by: Werner Koch <[email protected]>
* Add an export secret key feature.Werner Koch2015-08-241-1/+7
| | | | | | | | | | | | | | | | | | * src/gpgme.h.in (GPGME_EXPORT_MODE_SECRET): New. (GPGME_EXPORT_MODE_RAW): New. (GPGME_EXPORT_MODE_PKCS12): New. * src/export.c (export_start, export_ext_start): Allow new flags. * src/engine-gpg.c (export_common): Support secret key export. * src/engine-gpgsm.c (gpgsm_export, gpgsm_export_ext): Ditto. * src/gpgme-tool.c (cmd_export): Add options --secret, --raw, and --pkcs12. * tests/run-export.c (main): Likewise. -- Note that exporting secret X.509 keys requires GnuPG 2.1.8. Signed-off-by: Werner Koch <[email protected]>
* Add option --lib-version to gpgme-tool.Werner Koch2015-07-231-4/+23
| | | | | | * src/gpgme-tool.c (options, parse_options): Add --lib-version (CMD_LIBVERSION): New. (main): Implement.
* gpgme-tool: Print fingerprint and keyid with keyservers.Werner Koch2014-08-121-1/+3
| | | | | * src/gpgme-tool.c (cmd_keylist): Print keyid. Print FPR only if available.
* gpgme-tool: Fix segv for external key listing.Werner Koch2014-08-121-7/+10
| | | | * src/gpgme-tool.c (result_xml_escape): Allow for DATA being NULL.
* Add new keylist mode GPGME_KEYLIST_MODE_WITH_SECRET.Werner Koch2014-06-041-0/+10
| | | | | | | | | | | | | | * src/gpgme.h.in (GPGME_KEYLIST_MODE_WITH_SECRET): New. * src/engine-gpg.c (gpg_keylist_build_options): Handle new mode. * src/engine-gpgsm.c (gpgsm_keylist, gpgsm_keylist_ext): Ditto. * src/keylist.c (parse_sec_field15): Add arg key and take care of --with-secret output. * src/gpgme-tool.c (gt_get_keylist_mode, cmd_keylist_mode): Add "with_secret". Print card info and and secret flag for subkeys. -- Note: This mode may only be used with GnuPG >= 2.1.
* Add GPGME_ENCRYPT_NO_COMPRESS flag.Werner Koch2014-05-081-2/+4
| | | | | | * src/gpgme.h.in (GPGME_ENCRYPT_NO_COMPRESS): New. * src/engine-gpg.c (gpg_encrypt, gpg_encrypt_sign): Implement it. * src/gpgme-tool.c (_cmd_sign_encrypt): Add option --no-compress.
* Add GPGME_PROTOCOL_SPAWN and gpgme_op_spawn.Werner Koch2014-04-101-0/+64
| | | | | | | | | | | | | | | | | | * src/gpgme.h.in (GPGME_PROTOCOL_SPAWN): New. (GPGME_SPAWN_DETACHED, GPGME_SPAWN_ALLOW_SET_FG): New. * src/gpgme.c (gpgme_set_protocol): Add new protocol. (gpgme_get_protocol_name): Ditto. * src/spawn.c: New. * src/libgpgme.vers, src/gpgme.def: Add new public functions. * src/engine-spawn.c: New. * src/Makefile.am: Add new files. * src/engine-backend.h (struct engine_ops): Add OPSPAWN. * src/engine.c (engine_ops): Add _gpgme_engine_ops_spawn. (gpgme_get_engine_info): Add Spawn to the list of protocols. (_gpgme_engine_op_spawn): New. * src/gpgme-tool.c (gt_protocol_from_name): Add new protocol. (gt_spawn, cmd_spawn): New.
* Add function gpgme_data_identify.Werner Koch2013-08-091-7/+66
| | | | | | | | | | | | | | | | | | * src/gpgme.h.in (gpgme_data_type_t): New. (gpgme_data_identify): New prototype. * src/data-identify.c: New. * src/parsetlv.c, src/parsetlv.h: New. Take from gpa. * src/libgpgme.vers, src/gpgme.def: Add gpgme_data_identify. * src/gpgme-tool.c (status): Add STATUS_IDENTIFY_RESULT. (gt_identify): New. (cmd_identify): New. (hlp_passwd): Move close to cmd_passwd. -- It is often useful to have a way to identify the data which needs processing. This is such a common task that it makes sense to implement this in gpgme to avoid diverging implementations.
* gpgme-tool: Allow for symmetric encryption.Werner Koch2013-05-221-2/+5
| | | | | * src/gpgme-tool.c (gt_sign_encrypt): Pass NULL for recp if no recipients are given.
* Make definition of off_t robust against misbehaving w32 toolchains.Werner Koch2013-05-161-2/+2
| | | | | | | | | | | | | | | | * configure.ac (NEED__FILE_OFFSET_BITS): Change to define gpgme_off_t and gpgme_ssize_t. (API__OFF_T, API__SSIZE_T): New ac_subst. * src/gpgme.h.in: Replace all ssize_t and off_t by ac_subst macros. * src/assuan-support.c, src/ath-pthread.c, src/ath.c, src/ath.h * src/data-compat.c, src/data-fd.c, src/data-mem.c, src/data-stream.c * src/data-user.c, src/data.c, src/data.h, src/engine-gpgsm.c * src/engine-uiserver.c, src/gpgme-tool.c, src/gpgme.c: Replace off_t by gpgme_off_t and sszie_t by gpgme_ssize_t. * src/ath-pthread.c, src/ath.h: Include gpgme.h. -- For a detailed description, see the gpgme.texi diff.
* gpgme_tool: Support GPG's new pinentry-mode.Werner Koch2013-02-071-5/+113
| | | | | | | | | | | * src/gpgme-tool.c (log_error): Do not always print the error source. (gt_set_pinentry_mode): New. (server_passphrase_cb): New. (cmd_pinentry_mode): New. (register_commands): Add cmd_pinentry_mode. (options): Add option --gpg-binary. (struct args): Add field gpg-binary. (parse_options, main): Implement that option.
* Use gpg_error_from_syserror instead of directly accessing errno.Werner Koch2013-02-061-1/+1
| | | | | | | | -- Also fixed a couple of minor thing; e.g. save the error before calling cleanup functions. Do not save the errno if only free is called in between.
* gpgme-tool: Use membuf functions to build up strings.Werner Koch2012-10-111-32/+159
| | | | | | | | | | | * src/gpgme-tool.c (clear_membuf, init_membuf, put_membuf) (put_membuf_str, get_membuf, peek_membuf): Add membuf functions. Take from GnuPG master's common/membuf.[ch] and patch for our use. (result_xml_escape): Rewrite using new functions. -- First counting, then allocating, and finally copying data is prone to errors. We better use the membuf functions which make it much easier.
* gpgme-tool: Change license from LPGLv2+ to GPLv3+Werner Koch2012-10-111-4/+5
| | | | | | | | * src/gpgme-tool.c: Change license notice. -- gpgme-tool.c is a standalone program, thus it makes no sense to keep it under the LGPL. We already had the manual under GPLv3+.
* gpgme-tool: escape special characters in output XML data (<, >, and &).W. Trevor King2012-10-111-2/+67
| | | | | | | | | | | | | | | | | | | | [[PGP Signed Part:Undecided]] src/gpgme-tool.c (result_xml_escape_replacement, result_xml_escape): New. (result_xml_tag_data): Use result_xml_escape() to escape data. (result_add_error): Use unescaped < and >. -- This is a general solution for generating valid XML, but the specific output that inspired the change was from the KEYLIST command: <uid>William Trevor King <[email protected]></uid> Now the uids are properly escaped: <uid>William Trevor King &lt;[email protected]&gt;</uid> Signed-off-by: W. Trevor King <[email protected]>
* gpgme-tool: Fix chain_id -> chain-id in KEYLIST XML.W. Trevor King2012-10-111-1/+1
| | | | | | | | | | [[PGP Signed Part:Undecided]] src/gpgme-tool.c (cmd_keylist): Use <chain-id> instead of <chain_id>. -- All the other tags map struct attribute underscores to hyphens, so fixing <chain_id> follows the priciple of least surprise. Signed-off-by: W. Trevor King <[email protected]>
* gpgme-tool: Return more detailed XML from KEYLISTW. Trevor King2012-09-281-14/+120
| | | | | | | | | | | | | | | | | src/gpgme-tool.c (cmd_keylist): Convert output from a list of to more detailed XML. (xml_preamble1, xml_preamble2, xml_end): Make global. (result_add_protocol, result_add_validity): New functions for generating XML from GPGME types. (result_add_string): Treat NULL strings as "". (result_xml_tag_data): Make 'data' a 'const char' so we can use the value returned by gpgme_get_protocol_name directly. -- This is a first pass at returning most of the gpgme_key_t data from the KEYLIST call. Signed-off-by: W. Trevor King <[email protected]>
* gpgme-tool: Initialize input_fd and output_fdW. Trevor King2012-09-281-0/+2
| | | | | | * src/gpgme-tool.c (gpgme_server): Initialize input_fd and output_fd. Signed-off-by: W. Trevor King <[email protected]>
* gpgme-tool: Fix handling of file descriptorsWerner Koch2012-09-261-16/+35
| | | | | | | | | | | | | | * src/gpgme-tool.c (server_reset_fds): Use close/CloseHandle instead of the assuan close functions. (_cmd_decrypt_verify, _cmd_sign_encrypt, cmd_verify, cmd_import) (cmd_export, cmd_genkey, cmd_getauditlog): Use SERVER object instead of assuan_get_*_fd functions. -- Although we used our own handlers for INPUT and OUTPUT, we still used assuan_get_input_fd, assuan_get_output_fd and their close functions. That clearly can't work because libassuan does not have any values for them.
* Remove all trailing whitespace from source filesWerner Koch2012-09-251-76/+76
| | | | | -- Command used: sed -i 's,[ \t]*$,,' FILE
* gpgme-tool: add help messages for a number of commands.W. Trevor King2012-04-031-23/+137
| | | | | | | | | | * src/gpgme-tool.c (hlp_engine, hlp_sub_protocol, hlp_armor, hlp_textmode, hlp_include_certs, hlp_keylist_mode, hlp_input, hlp_output, hlp_message, hlp_recipient, hlp_signer, hlp_signers_clear, hlp_decrypt, hlp_decrypt_verify, hlp_encrypt, hlp_sign_encrypt, hlp_sign, hlp_verify, hlp_import): New strings. (hlp_protocol): Fix typo. (register_commands): Add documentation strings. (doc): Mention Assuan.
* Allow multiple patterns for KEYLIST.Werner Koch2010-12-081-6/+59
|
* Enable debugging feature for W32CE.Werner Koch2010-10-071-1/+5
| | | | | kFreeBSD portability fix.
* Too embarrassing for a changelog entry.Marcus Brinkmann2010-08-041-1/+1
|
* 2010-08-03 Marcus Brinkmann <[email protected]>Marcus Brinkmann2010-08-031-7/+12
| | | | | | | | * gpgme-tool.c (result_encrypt_to_xml, result_sign_to_xml) (result_verify_to_xml, result_import_to_xml) (result_genkey_to_xml): Check vigorously for null pointers.
* 2010-06-10 Marcus Brinkmann <[email protected]>Marcus Brinkmann2010-06-101-0/+5
| | | | | | * gpgme-tool.c (gpgme_server): Use special hack for Windows CE to get at stdin and stdout.
* 2010-06-09 Marcus Brinkmann <[email protected]>Marcus Brinkmann2010-06-091-46/+191
| | | | | | | | | | | | | | | | | | | | | | * gpgme-tool.c (result_add_timestamp): Add missing NULL argument. (result_sign_to_xml): Protect against NULL fingerprint. (struct server): New members input_fd, input_filename, input_stream output_fd, output_filename, output_stream, message_filename, message_stream. (server_reset_fds): Deallocate those. (server_parse_fd): New function. (server_data_obj): Take optional filename argument and direction argument. Also take new argument to return a filestream that needs to be closed after destroying the data object. Change all callers, too. (input_notify, output_notify): Removed. (cmd_input, cmd_output): New functions. (gpgme_server): Do not register input and output notifier. (register_commands): Use cmd_input and cmd_output. (cmd_message): Rewritten to use server_parse_fd. (cmd_delete, cmd_keylist): Fix inverted option check. (main) [HAVE_W32CE_SYSTEM]: Sleep a bit to work around bug in ssh.
* 2010-05-12 Marcus Brinkmann <[email protected]>Marcus Brinkmann2010-05-121-0/+2
| | | | | | | | | | | * configure.ac: Check for setlocale. src/ 2010-05-12 Marcus Brinkmann <[email protected]> * gpgme-tool.c (main): Protect call to setlocale with HAVE_SETLOCALE.
* 2010-05-07 Marcus Brinkmann <[email protected]>Marcus Brinkmann2010-05-071-0/+5
| | | | | | | | | * engine-g13.c, gpgme.c, engine-gpgsm.c, engine-gpg.c, op-support.c, engine-assuan.c, gpgme-tool.c: Include <locale.h> only if available with HAVE_LOCALE_H and conditionalize use of LC_CTYPE on its definition. * engine-gpgconf.c: Do not include <locale.h>.
* 2010-05-07 Marcus Brinkmann <[email protected]>Marcus Brinkmann2010-05-071-4/+9
| | | | | | | | | | | * engine-gpgsm.c (gpgsm_new, start): Cast between int and assuan_fd_t. * assuan-support.c (my_pipe, my_close, my_read, my_write): Likewise. * gpgme-tool.c (server_data_obj, server_reset_fds, gpgme_server), (my_recvmsg, my_sendmsg, my_spawn): Likewise. * engine-assuan.c (start): Likewise. * engine-g13.c (start): Likewise.
* 2010-05-06 Marcus Brinkmann <[email protected]>Marcus Brinkmann2010-05-061-2/+2
| | | | | | | | | | | | | | | | | | | * configure.ac: Require libgpg-error 1.8. src/ 2010-05-06 Marcus Brinkmann <[email protected]> * sign.c, data-user.c, conversion.c, debug.c, verify.c, data.c, decrypt.c, delete.c, assuan-support.c, import.c, engine-gpgsm.c, data-mem.c, op-support.c, w32-io.c, w32-util.c, data-compat.c: Use gpg_error_from_syserror instead gpg_error_from_errno, and use gpg_err_set_errno to set error number. * setenv.c: Include <gpg-error.h> and define __set_errno to use gpg_err_set_errno. * gpgme-tool.c (ARGP_ERR_UNKNOWN): Define to EDEADLOCK (which is mapped in Windows CE) instead of E2BIG (which is not). (gt_import_keys): Initialize err.
* Add option GPGME_EXPORT_MODE_MINIMALWerner Koch2010-02-161-7/+45
|
* Convert C++ comments to C90 comments.Werner Koch2010-02-161-13/+13
|