aboutsummaryrefslogtreecommitdiffstats
path: root/src/gpgme-tool.c (unfollow)
Commit message (Collapse)AuthorFilesLines
2024-07-15core: Support all keylist modes and fix possible overrunIngo Klöcker1-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.
2023-09-29gpgme-tool: Support use of Windows HANDLE for INPUT/OUTPUT/MESSAGE.NIIBE Yutaka1-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]>
2022-04-27core: Support --locate-external-keys command of gpgIngo Klöcker1-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
2022-01-04core: Add new option --secret-subkey to help texts.Ingo Klöcker1-1/+2
* src/gpgme-tool.c (hlp_export): Add new option. * tests/run-export.c (show_usage): Print new option. -- GnuPG-bug-id: 5757
2022-01-04core: New export mode to export secret subkeys.Ingo Klöcker1-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
2019-12-03gpgme-tool: Fix help text for INCLUDE_CERTS.Daniel Kahn Gillmor1-1/+1
* src/gpgme-tool.c (hlp_include_certs): added missing newline. Signed-off-by: Daniel Kahn Gillmor <[email protected]>
2018-11-16Add SPDX identifiers to most source filesWerner Koch1-17/+18
-- Signed-off-by: Werner Koch <[email protected]>
2018-10-31w32: Remove all support for WindowsCEWerner Koch1-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]>
2018-03-04IDENTIFYBen McGinnes1-1/+1
* Fixed sp error in docstring.
2016-11-16doc: Replace http: by https: in core source files.Werner Koch1-1/+1
-- Signed-off-by: Werner Koch <[email protected]>
2016-09-13core: Use const char * where appropriate.Werner Koch1-14/+18
Signed-off-by: Werner Koch <[email protected]>
2016-09-13core: Mark unused function args.Werner Koch1-0/+18
Signed-off-by: Werner Koch <[email protected]>
2016-09-13core: Do not pass const char* to functions taking a char*.Werner Koch1-2/+3
Signed-off-by: Werner Koch <[email protected]>
2016-07-19Fix including nil bytes in keylist output.Ben Kibbey1-6/+6
* src/gpgme-tool.c (cmd_keylist,gt_result): use strlen(). Signed-off-by: Ben Kibbey <[email protected]>
2016-07-13core: New GPGME_DATA_ENCODING_MIME.Werner Koch1-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]>
2016-06-21tests: Add new test tool run-identify.Werner Koch1-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]>
2015-08-31gpgme-tool: Switch to argparse.c for option parsing.Werner Koch1-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]>
2015-08-24Add an export secret key feature.Werner Koch1-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]>
2015-07-23Add option --lib-version to gpgme-tool.Werner Koch1-4/+23
* src/gpgme-tool.c (options, parse_options): Add --lib-version (CMD_LIBVERSION): New. (main): Implement.
2014-08-12gpgme-tool: Print fingerprint and keyid with keyservers.Werner Koch1-1/+3
* src/gpgme-tool.c (cmd_keylist): Print keyid. Print FPR only if available.
2014-08-12gpgme-tool: Fix segv for external key listing.Werner Koch1-7/+10
* src/gpgme-tool.c (result_xml_escape): Allow for DATA being NULL.
2014-06-04Add new keylist mode GPGME_KEYLIST_MODE_WITH_SECRET.Werner Koch1-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.
2014-05-08Add GPGME_ENCRYPT_NO_COMPRESS flag.Werner Koch1-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.
2014-04-10Add GPGME_PROTOCOL_SPAWN and gpgme_op_spawn.Werner Koch1-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.
2013-08-09Add function gpgme_data_identify.Werner Koch1-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.
2013-05-22gpgme-tool: Allow for symmetric encryption.Werner Koch1-2/+5
* src/gpgme-tool.c (gt_sign_encrypt): Pass NULL for recp if no recipients are given.
2013-05-16Make definition of off_t robust against misbehaving w32 toolchains.Werner Koch1-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.
2013-02-07gpgme_tool: Support GPG's new pinentry-mode.Werner Koch1-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.
2013-02-06Use gpg_error_from_syserror instead of directly accessing errno.Werner Koch1-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.
2012-10-11gpgme-tool: Use membuf functions to build up strings.Werner Koch1-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.
2012-10-11gpgme-tool: Change license from LPGLv2+ to GPLv3+Werner Koch1-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+.
2012-10-11gpgme-tool: escape special characters in output XML data (<, >, and &).W. Trevor King1-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]>
2012-10-11gpgme-tool: Fix chain_id -> chain-id in KEYLIST XML.W. Trevor King1-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]>
2012-09-28gpgme-tool: Return more detailed XML from KEYLISTW. Trevor King1-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]>
2012-09-28gpgme-tool: Initialize input_fd and output_fdW. Trevor King1-0/+2
* src/gpgme-tool.c (gpgme_server): Initialize input_fd and output_fd. Signed-off-by: W. Trevor King <[email protected]>
2012-09-26gpgme-tool: Fix handling of file descriptorsWerner Koch1-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.
2012-09-25Remove all trailing whitespace from source filesWerner Koch1-76/+76
-- Command used: sed -i 's,[ \t]*$,,' FILE
2012-04-03gpgme-tool: add help messages for a number of commands.W. Trevor King1-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.
2010-12-08Allow multiple patterns for KEYLIST.Werner Koch1-6/+59
2010-10-07Enable debugging feature for W32CE.Werner Koch1-1/+5
kFreeBSD portability fix.
2010-08-04Too embarrassing for a changelog entry.Marcus Brinkmann1-1/+1
2010-08-032010-08-03 Marcus Brinkmann <[email protected]>Marcus Brinkmann1-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-102010-06-10 Marcus Brinkmann <[email protected]>Marcus Brinkmann1-0/+5
* gpgme-tool.c (gpgme_server): Use special hack for Windows CE to get at stdin and stdout.
2010-06-092010-06-09 Marcus Brinkmann <[email protected]>Marcus Brinkmann1-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-122010-05-12 Marcus Brinkmann <[email protected]>Marcus Brinkmann1-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-072010-05-07 Marcus Brinkmann <[email protected]>Marcus Brinkmann1-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-072010-05-07 Marcus Brinkmann <[email protected]>Marcus Brinkmann1-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-062010-05-06 Marcus Brinkmann <[email protected]>Marcus Brinkmann1-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.
2010-02-16Add option GPGME_EXPORT_MODE_MINIMALWerner Koch1-7/+45
2010-02-16Convert C++ comments to C90 comments.Werner Koch1-13/+13