From 0221d7f28a315d305409cf2dcae853c22ad94d31 Mon Sep 17 00:00:00 2001 From: Ingo Klöcker Date: Thu, 14 Dec 2023 10:59:47 +0100 Subject: core: Support direct encryption of file with gpg * src/gpgme.h.in (GPGME_ENCRYPT_FILE): New encryption flag. * src/engine-gpg.c (gpg_encrypt, gpg_encrypt_sign): Check for incompatible flags. Pass filename instead of fd to gpg when new flag is set. * src/engine-gpgsm.c (gpgsm_encrypt): Return error if new flag is set. * src/engine-uiserver.c (uiserver_encrypt): Ditto. * tests/run-encrypt.c (show_usage): New option --direct-file-io. (main): Parse new option. Make gpg read the input file itself if the option is given. -- With this change the gpgme_op_encrypt* and gpgme_op_encrypt_sign* functions gain the possibility to make gpg read the data to (sign and) encrypt directly from a file instead of from an input FD to which it is written by gpgme. GnuPG-bug-id: 6550 --- doc/gpgme.texi | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'doc') diff --git a/doc/gpgme.texi b/doc/gpgme.texi index 11f90133..0ec70a55 100644 --- a/doc/gpgme.texi +++ b/doc/gpgme.texi @@ -6557,7 +6557,14 @@ file set with @code{gpgme_data_set_file_name} for the data object @var{cipher}. The type of the ciphertext created is determined by the @acronym{ASCII} armor (or, if that is not set, by the encoding specified for @var{cipher}) and the text mode attributes set for the context -@var{ctx}. +@var{ctx}. If a filename has been set with @code{gpgme_data_set_file_name} +for the data object @var{plain} then this filename is stored in the +ciphertext. + +If the flag @code{GPGME_ENCRYPT_FILE} is set and a filename has been set +with @code{gpgme_data_set_file_name} for the data object @var{plain}, +then this filename is passed to gpg, so that gpg reads the plaintext +directly from this file instead of from the data object @var{plain}. If the flag @code{GPGME_ENCRYPT_ARCHIVE} is set, then an encrypted archive is created from the files and directories given as NUL-separated @@ -6653,6 +6660,15 @@ NUL-separated list of file paths and directory paths that shall be encrypted into an archive. This feature is currently only supported for the OpenPGP crypto engine and requires GnuPG 2.4.1. +@item GPGME_ENCRYPT_FILE +@since{1.24.0} + +The @code{GPGME_ENCRYPT_FILE} symbol specifies that the filename set +with @code{gpgme_data_set_file_name} for the data object @var{plain} +is passed to gpg, so that gpg reads the plaintext directly from this +file instead of from the data object @var{plain}. This feature is +currently only supported for the OpenPGP crypto engine. + @end table If @code{GPG_ERR_UNUSABLE_PUBKEY} is returned, some recipients in -- cgit