Commit Graph

3640 Commits

Author SHA1 Message Date
Ingo Klöcker
f2575b6313
json: Add information about revocation keys to key list result
* src/gpgme-json.c (revocation_key_to_json): New.
(key_to_json): Add list of revocation keys.

* tests/json/Makefile.am (pubring-stamp): Import new pub key.
* tests/json/key-with-revokers.asc: New.
* tests/json/t-json.c (tests): Add "t-keylist-revokers".
* tests/json/t-keylist-revokers.in.json,
tests/json/t-keylist-revokers.in.json: New.
--

GnuPG-bug-id: 7118
2024-05-21 16:38:59 +02:00
Ingo Klöcker
adadfac997
core: Add information about revocation keys to keys
* src/gpgme.h.in (struct _gpgme_revocation_key,
gpgme_revocation_key_t): New.
(struct _gpgme_key): Add fields 'revkeys', '_last_revkey'.
* src/key.c (_gpgme_key_add_rev_key): New.
(gpgme_key_unref): Free revkeys.
* src/keylist.c (keylist_colon_handler): Parse rvk lines.
* src/ops.h (_gpgme_key_add_rev_key): New.

* tests/run-keylist.c (main): Print revocation key info.
--

GnuPG-bug-id: 7118
2024-05-21 16:38:59 +02:00
Werner Koch
ac4bf86bb6
tests: Fix segv in t-json.c
* tests/json/t-json.c (test_contains): Avoid calling recusivly with no
child.
2024-05-21 14:36:07 +02:00
Werner Koch
55a1ae4163
tests: Avoid some compiler warnings.
* tests/gpg/t-support.h (fail_with_syserr): New.
(check_data): Use it to avoid compiler warnings.
* tests/run-support.h (fail_with_syserr): New.
--

I don't think that there is a way to tell gcc that
gpgme_err_code_from_errno will never return 0.  Thus we better use a
different macro.
2024-05-21 13:45:02 +02:00
Ingo Klöcker
c933269d3a
qt: Avoid bogus stringop-overread warning
* lang/qt/src/threadedjobmixin.cpp (_detail::audit_log_as_html): Use
QByteArray overload of QString::fromUtf8.
--

There's no need to make the code more complicated than necessary. Unless
we want to provoke weird compiler warnings. :-)
2024-05-21 12:36:11 +02:00
Ingo Klöcker
333241b286
qt: Fix warning about missing return
* lang/qt/src/qgpgmeexportjob.cpp (ExportJob::exec): Return a value and
remove unused argument names.
--

ExportJob::exec is never executed because its virtual overload is always
used. Therefore it doesn't matter what value we return.
2024-05-21 12:24:31 +02:00
Werner Koch
73403a8ba0
core: speedup gpgme_get_key
* src/engine.c (_gpgme_set_engine_info): Change engine_get_version.
--

GnuPG-bug-id: 6369
2024-05-21 10:59:43 +02:00
NIIBE Yutaka
0f5e8182e7
m4: Update libassuan.m4 from master.
* m4/libassuan.m4: Update.

--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2024-05-17 14:22:36 +09:00
Ingo Klöcker
3e3db5784f
Require at least libgpg-error 1.47
* configure.ac (NEED_GPG_ERROR_VERSION): Require 1.47.
--

Libgpg-error 1.47 has been released more than 1 year ago and we use a
new error code defined in this version.

GnuPG-bug-id: 6971
2024-05-16 10:29:50 +02:00
NIIBE Yutaka
87061c0260
gpgme.m4: Set $host correctly always.
* src/gpgme.m4 (AM_PATH_GPGME): Add AC_CANONICAL_HOST.

--

GnuPG-bug-id: 7114
Reported-by: Andreas Metzler
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2024-05-16 09:27:58 +09:00
Ingo Klöcker
a73a41109f
tests: Fix test after changed behavior of gpgme_op_verify
* tests/gpg/t-verify.c (main): Change assertion of test.
--

The change introduced with 1dc44b7c makes gpg abort the verification
of a clear-signed message if it encounters garbage following the
signed data. We have to adapt the test to this change.

GnuPG-bug-id: 6907
2024-05-15 11:53:06 +02:00
NIIBE Yutaka
06db03ea9b
doc: Update use of Autoconf with PKG_CHECK_MODULES.
--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2024-05-14 11:42:24 +09:00
NIIBE Yutaka
882ccc8ea7
gpgme.m4: Update _AM_PATH_GPGRT_CONFIG macro from gpg-error.m4.
* src/gpgme.m4 (_AM_PATH_GPGRT_CONFIG): Update.

--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2024-05-14 10:30:47 +09:00
Ingo Klöcker
e4a95746ad
cpp: Handle smart card op failure status messages
* lang/cpp/src/editinteractor.cpp (parse_sc_op_failure): New.
(CallbackHelper::edit_interactor_callback_impl): Parse failure code on
GPGME_STATUS_SC_OP_FAILURE status.
(sc_op_failure_to_error): New.
--

This converts a SC_OP_FAILURE status message logged by gpg to a
corresponding error. Unfortunately, GPG_ERR_BAD_PIN and
GPG_ERR_BAD_RESET_CODE are mapped to the same SC_OP_FAILURE code, so
that we had to choose one.

GnuPG-bug-id: 6971
2024-04-05 15:08:01 +02:00
Andre Heinecke
67057d83f5
Qt: Fix windows build of new jobs
--
See git log for changes.
2024-03-13 13:15:41 +01:00
Ingo Klöcker
7158397c09
core: Check STATUS_FAILURE in import operations.
* src/import.c (op_data_t): Add failure_code.
(_gpgme_import_status_handler): Set it. Return it on EOF.
--

GnuPG-bug-id: 7036
2024-03-11 13:53:18 +01:00
Tobias Fella
47f3d92bf3
qt: Add function for synchronously executing ExportJob
* lang/qt/src/exportjob: Add exec function.
* lang/qt/src/qgpgmeexportjob.cpp: Implement exec function.
* lang/qt/src/qgpgmeexportjob.h: Override exec function.

--

GnuPG-Bug-Id: 6893
2024-01-22 11:24:49 +01:00
Ingo Klöcker
0011412193
qt: Remove superfluous virtual overrides and member variables
* lang/qt/src/qgpgmeaddexistingsubkeyjob.cpp
(QGpgMEAddExistingSubkeyJob::exec): Remove call of resultHook.
* lang/qt/src/qgpgmedecryptjob.cpp (QGpgMEDecryptJob::exec): Remove
call of resultHook.
(QGpgMEDecryptJob::resultHook): Remove.
* lang/qt/src/qgpgmedecryptjob.h (QGpgMEDecryptJob): Remove resultHook
override. Remove member mResult.
* lang/qt/src/qgpgmedecryptverifyjob.cpp (QGpgMEDecryptVerifyJob::exec):
Remove call of resultHook.
(QGpgMEDecryptVerifyJob::resultHook): Remove.
* lang/qt/src/qgpgmedecryptverifyjob.h (QGpgMEDecryptVerifyJob): Remove
resultHook override. Remove member mResult.
* lang/qt/src/qgpgmeencryptjob.cpp (QGpgMEEncryptJob::exec): Remove
call of resultHook.
(QGpgMEEncryptJob::resultHook): Remove.
* lang/qt/src/qgpgmeencryptjob.h (QGpgMEEncryptJob): Remove resultHook
override. Remove member mResult.
* lang/qt/src/qgpgmegpgcardjob.cpp (QGpgMEGpgCardJob::exec): Remove
call of resultHook.
* lang/qt/src/qgpgmeimportfromkeyserverjob.cpp
(QGpgMEImportFromKeyserverJob::exec): Remove call of resultHook.
(QGpgMEImportFromKeyserverJob::resultHook): Remove.
* lang/qt/src/qgpgmeimportfromkeyserverjob.h
(QGpgMEImportFromKeyserverJob): Remove resultHook override. Remove
member mResult.
* lang/qt/src/qgpgmeimportjob.cpp (QGpgMEImportJob::exec): Remove call
of resultHook.
(QGpgMEImportJob::resultHook): Remove.
* lang/qt/src/qgpgmeimportjob.h (QGpgMEImportJob): Remove resultHook
override. Remove member mResult.
* lang/qt/src/qgpgmekeyformailboxjob.cpp (QGpgMEKeyForMailboxJob::exec):
Remove call of resultHook.
* lang/qt/src/qgpgmekeylistjob.cpp (QGpgMEKeyListJob::QGpgMEKeyListJob):
Remove initialization of mResult.
(QGpgMEKeyListJob::resultHook): Do not set (removed) mResult.
* lang/qt/src/qgpgmekeylistjob.h (QGpgMEKeyListJob): Remove member
mResult.
* lang/qt/src/qgpgmelistallkeysjob.cpp
(QGpgMEListAllKeysJob::QGpgMEListAllKeysJob): Remove initialization of
mResult.
(QGpgMEListAllKeysJob::exec): Remove call of resultHook.
(QGpgMEListAllKeysJob::resultHook): Remove.
* lang/qt/src/qgpgmelistallkeysjob.h (QGpgMEListAllKeysJob): Remove
resultHook override. Remove member mResult.
* lang/qt/src/qgpgmereceivekeysjob.cpp (QGpgMEReceiveKeysJob::exec):
Remove call of resultHook.
(QGpgMEReceiveKeysJob::resultHook): Remove.
* lang/qt/src/qgpgmereceivekeysjob.h (QGpgMEReceiveKeysJob): Remove
resultHook override. Remove member mResult.
* lang/qt/src/qgpgmerevokekeyjob.cpp (QGpgMERevokeKeyJob::exec): Remove
call of resultHook.
* lang/qt/src/qgpgmesignencryptjob.cpp (QGpgMESignEncryptJob::exec):
Remove call of resultHook.
(QGpgMESignEncryptJob::resultHook): Remove.
* lang/qt/src/qgpgmesignencryptjob.h (QGpgMESignEncryptJob): Remove
resultHook override. Remove member mResult.
* lang/qt/src/qgpgmesignjob.cpp (QGpgMESignJob::exec): Remove call of
resultHook.
(QGpgMESignJob::resultHook): Remove.
* lang/qt/src/qgpgmesignjob.h (QGpgMESignJob): Remove resultHook
override. Remove member mResult.
* lang/qt/src/qgpgmeverifydetachedjob.cpp
(QGpgMEVerifyDetachedJob::exec): Remove call of resultHook.
(QGpgMEVerifyDetachedJob::resultHook): Remove.
* lang/qt/src/qgpgmeverifydetachedjob.h (QGpgMEVerifyDetachedJob):
Remove resultHook override. Remove member mResult.
* lang/qt/src/qgpgmeverifyopaquejob.cpp (QGpgMEVerifyOpaqueJob::exec):
Remove call of resultHook.
(QGpgMEVerifyOpaqueJob::resultHook): Remove.
* lang/qt/src/qgpgmeverifyopaquejob.h (QGpgMEVerifyOpaqueJob): Remove
resultHook override. Remove member mResult.
* lang/qt/src/qgpgmewkdlookupjob.cpp (QGpgMEWKDLookupJob::exec):
Remove call of resultHook.
--

All overrides of resultHook (except for the one of QGpgMEKeyListJob)
are superfluous. All the resultHook overrides do is store the result in
a member variable which is then returned in exec() (which just before
returning calls resultHook). The member variable the result is stored in
is only ever used by exec(). So exec() can simply return the result
directly. Some Job subclasses call resultHook without overriding it.
That's equally useless because the default implementation of resultHook
is empty. The only resultHook override that does anything useful is the
one of QGpgMEKeyListJob.
2024-01-19 16:07:14 +01:00
Ingo Klöcker
eae22d9a48
qt: Remove left-over mentions of showErrorDialog
* lang/qt/src/qgpgmedecryptjob.cpp,
lang/qt/src/qgpgmeimportfromkeyserverjob.cpp,
lang/qt/src/qgpgmeimportjob.cpp: Remove obsolete comment.
* lang/qt/src/qgpgmekeylistjob.cpp,
lang/qt/src/qgpgmelistallkeysjob.cpp: Remove long obsolete, #if 0'ed out
definitions of showErrorDialog.
--

Informing the users about errors is the responsibility of the users of
the QGpgME Job API since a long time.
2024-01-19 15:44:22 +01:00
Ingo Klöcker
cc1f2b5acb
build: Re-add still needed custom changes to Python autoconf macro
* m4/ax_python_devel.m4: Do not emit 'HAVE_PYTHON'.
--

This reapplies the changes made with 5189c08 that are still needed for
detecting multiple Python versions.
2024-01-16 09:58:33 +01:00
Ingo Klöcker
e3ae88267f
build: Update Python autoconf macro
* configure.ac: Call AX_PYTHON_DEVEL with new "optional" argument.
* m4/ax_python_devel.m4: Replace with current version from the autoconf
archive.
--

The new "optional" argument allows us to leave out one of our custom
changes.
2024-01-16 09:53:39 +01:00
Werner Koch
18388f93ab
doc: Add a deprecated warning to gpgme_op_delete. 2024-01-15 11:12:29 +01:00
Werner Koch
b37efb11be
doc: Fix minor typo.
--

Reported-by: Ming Kuang
2024-01-15 08:30:01 +01:00
Ingo Klöcker
85c7a94d63
cpp,tests: Launch dirmngr with gpg-conf
* lang/cpp/tests/run-wkdlookup.cpp (main): Replace backslashes with
forward slashes in homedir returned by GpgME::dirInfo. Use "gpgconf
--launch dirmngr" to start dirmngr.
--

With this change the same code as by QGpgMEWKDLookupJob is again used to
launch dirmngr. It also fixes the bad example of starting dirmngr
without the help of gpgconf.

GnuPG-bug-id: 6833
2024-01-09 11:22:43 +01:00
Ingo Klöcker
7e520213c0
qt: Pass home directory with forward slashes when launching dirmngr
* lang/qt/src/qgpgmewkdlookupjob.cpp (startDirmngr): Replace backslashes
with forward slashes in homedir returned by GpgME::dirInfo.
--

This works around a bug which causes backslashes to be escaped (doubled)
twice on Windows, once by gpgme_op_spawn and once by the spawn helper
gpgme-w32spawn. The next versions of GnuPG 2.2 and 2.4 also have a
workaround for this.

GnuPG-bug-id: 6833
2024-01-09 11:13:51 +01:00
Tobias Fella
d60d1b7f79
qt: Fix validity for (sub)keys generated using QGpgMEQuickJob
* lang/qt/src/qgpgmequickjob.cpp: Fix expiration calculation
--

The job calculates the validity as the seconds since epoch,
while GPG expects the seconds since the current time.
This leads to the validity being significantly longer than expected.

GnuPG-Bug-Id: 6889
2024-01-08 14:36:26 +01:00
Ingo Klöcker
18a0d72b1b
doc: Update NEWS
--

GnuPG-bug-id: 6550
2024-01-05 13:48:22 +01:00
Ingo Klöcker
c631622484
qt: Support verification of detached signatures directly from files
* lang/qt/src/Makefile.am: Add new files.
* lang/qt/src/job.cpp (VerifyDetachedJob): Move definition of
constructor and destructor and inclusion of the moc file to the
corresponding .cpp file.
* lang/qt/src/verifydetachedjob.cpp: New.
* lang/qt/src/verifydetachedjob.h (VerifyDetachedJob): Add member
functions setSignatureFile, signatureFile, setSignedFile, signedFile.
* lang/qt/src/verifydetachedjob_p.h: New.
* lang/qt/src/qgpgmeverifydetachedjob.cpp (class
QGpgMEVerifyDetachedJobPrivate): New.
(QGpgMEVerifyDetachedJob::QGpgMEVerifyDetachedJob): Instantiate private
job class.
(verify_from_filename): New.

* lang/qt/tests/Makefile.am: Add new test program.
* lang/qt/tests/run-verifydetachedjob.cpp: New.
--

This makes it possible to tell gpg to read the input directly from the
specified files bypassing GpgME's Data IO when verifying a detached
signature.

GnuPG-bug-id: 6550
2024-01-05 12:10:22 +01:00
Ingo Klöcker
1dc44b7c5b
core: Tell gpg that we want to verify signed data
* src/engine-gpg.c (gpg_verify): Add "--verify" to command line.
--

Since GnuPG 2.1.16 --verify writes the signed data to the file specified
by --output. Explicitly telling gpg that we want to verify signed data
frees gpg from guessing what we want and avoids the corresponding
warning "no command supplied.  Trying to guess what you mean ..."

GnuPG-bug-id: 6907
2023-12-22 10:37:34 +01:00
Ingo Klöcker
0b3c8709f7
qt,doc: Document that Job::startIt() doesn't self-destruct Job on error
--
GnuPG-bug-id: 6550
2023-12-22 10:35:15 +01:00
Ingo Klöcker
e77a8ac0cc
qt: Support verification of opaque signed data directly to/from files
* lang/qt/src/Makefile.am: Add new files.
* lang/qt/src/job.cpp (VerifyOpaqueJob): Move definition of constructor
and destructor and inclusion of the moc file to the corresponding .cpp
file.
* lang/qt/src/verifyopaquejob.cpp: New.
* lang/qt/src/verifyopaquejob.h (VerifyOpaqueJob): Add member
functions setInputFile, inputFile, setOutputFile, outputFile.
* lang/qt/src/verifyopaquejob_p.h: New.
* lang/qt/src/qgpgmeverifyopaquejob.cpp (class
QGpgMEVerifyOpaqueJobPrivate): New.
(QGpgMEVerifyOpaqueJob::QGpgMEVerifyOpaqueJob): Instantiate private
job class.
(verify_from_filename): New.

* lang/qt/tests/Makefile.am: Add new test program.
* lang/qt/tests/run-verifyopaquejob.cpp: New.
--

This makes it possible to tell gpg to read the input and write the
output directly to a specified file bypassing GpgME's Data IO when
verifying an opaque signed (or clear signed) file.

GnuPG-bug-id: 6550
2023-12-22 10:05:16 +01:00
Ingo Klöcker
20b32e0350
qt: Support decryption (with verification) directly to/from files
* lang/qt/src/Makefile.am: Add new files.
* lang/qt/src/job.cpp (DecryptVerifyJob): Move definition of constructor
and destructor and inclusion of the moc file to the corresponding .cpp
file.
* lang/qt/src/decryptverifyjob.cpp: New.
* lang/qt/src/decryptverifyjob.h (DecryptVerifyJob): Add member
functions setInputFile, inputFile, setOutputFile, outputFile.
* lang/qt/src/decryptverifyjob_p.h: New.
* lang/qt/src/qgpgmedecryptverifyjob.cpp (class
QGpgMEDecryptVerifyJobPrivate): New.
(QGpgMEDecryptVerifyJob::QGpgMEDecryptVerifyJob): Instantiate private
job class.
(decrypt_verify_from_filename): New.

* lang/qt/tests/Makefile.am: Add new test program.
* lang/qt/tests/run-decryptverifyjob.cpp: New.
--

This makes it possible to tell gpg to read the input and write the
output directly to a specified file bypassing GpgME's Data IO when
decrypting (and verifying) a file.

GnuPG-bug-id: 6550
2023-12-22 10:01:17 +01:00
Ingo Klöcker
a44d84772d
qt: Support writing/reading signed/encrypted files directly to/from file
* lang/qt/src/Makefile.am: Add new files.
* lang/qt/src/job.cpp (EncryptJob, SignJob, SignEncryptJob): Move
definition of constructor and destructor and inclusion of the moc file
to the corresponding .cpp files.
* lang/qt/src/encryptjob.cpp (EncryptJob): Define constructor. Define
destructor as default. Include moc file.
* lang/qt/src/encryptjob.cpp, lang/qt/src/encryptjob.h (EncryptJob):
Add member functions setRecipients, recipients, setInputFile, inputFile,
setOutputFile, outputFile, setEncryptionFlags, encryptionFlags.
* lang/qt/src/encryptjob_p.h (EncryptJobPrivate): Add members
m_recipients, m_inputFilePath, m_outputFilePath, m_encryptionFlags.
* lang/qt/src/qgpgmeencryptjob.cpp (encrypt_to_filename): New.
(QGpgMEEncryptJobPrivate::startIt): Start the job with the values
from the member variables.
* lang/qt/src/qgpgmesignencryptjob.cpp (sign_encrypt_to_filename): New.
(QGpgMESignEncryptJobPrivate::startIt): Start the job with the values
from the member variables.
* lang/qt/src/qgpgmesignjob.cpp (class QGpgMESignJobPrivate): New.
(QGpgMESignJob::QGpgMESignJob): Instantiate private job class.
(sign_to_filename): New.
* lang/qt/src/signencryptjob.cpp (SignEncryptJob): Define constructor.
Define destructor as default. Include moc file.
* lang/qt/src/signencryptjob.cpp, lang/qt/src/signencryptjob.h
(SignEncryptJob): Add member functions setSigners, signers,
setRecipients, recipients, setInputFile, inputFile, setOutputFile,
outputFile, setEncryptionFlags, encryptionFlags.
* lang/qt/src/signencryptjob_p.h (SignEncryptJobPrivate): Add members
m_signers, m_recipients, m_inputFilePath, m_outputFilePath,
m_encryptionFlags.
* lang/qt/src/signjob.cpp: New.
* lang/qt/src/signjob.h (SignJob): Add member functions setSigners,
signers, setInputFile, inputFile, setOutputFile, outputFile,
setSigningFlags, signingFlags.
* lang/qt/src/signjob_p.h: New.
* lang/qt/tests/Makefile.am: Add new test programs.
* lang/qt/tests/run-encryptjob.cpp: New.
* lang/qt/tests/run-signjob.cpp: New.
--

This makes it possible to tell gpg to read the input and write the
output directly to a specified file bypassing GpgME's Data IO when
signing and/or encrypting a file.

GnuPG-bug-id: 6550
2023-12-21 11:49:23 +01:00
Ingo Klöcker
b166958b86
qt: Remove dead code
* lang/qt/src/qgpgmeencryptjob.cpp,
lang/qt/src/qgpgmesignencryptjob.cpp, lang/qt/src/qgpgmesignjob.cpp:
Remove long commented out showErrorDialog member function definitions.
--

Displaying error messages is delegated to the job users since ages.
2023-12-21 09:12:43 +01:00
Ingo Klöcker
60c0fd7c95
cpp: Support new flags for direct signing/encryption of files
* lang/cpp/src/context.h (enum EncryptionFlags): Add constant
EncryptFile.
* lang/cpp/src/global.h (enum SignatureMode): Add constant SignFile.
* lang/cpp/src/context.cpp (sigflags2sigflags): Handle new flag
SignFile.
(encryptflags2encryptflags): Handle new flag EncryptFile.
(operator<<): Add new flags to the corresponding debug streams.
* lang/cpp/src/signingresult.cpp (CreatedSignature::mode): Handle
new flag SignFile (even if it cannot occur).
--

GnuPG-bug-id: 6550
2023-12-19 14:01:18 +01:00
Ingo Klöcker
5efd3486a9
core: Support writing the decrypt/verify output directly to a file
* src/engine-gpg.c (gpg_decrypt): Pass output file name to gpg if output
has file name set.
(gpg_verify): Ditto.

* tests/run-decrypt.c (show_usage): New option --output.
(main): Parse new option. Set file name on output if --output is given.
Do not print output if --output is given.
* tests/run-verify.c (show_usage): New option --output.
(main): Parse new option. Set file name on output if --output is given.
--

This change makes it possible to tell gpg to write the output (i.e. the
decrypted/verified data) directly to a file with given file name instead
of piping the output back to gpgme.

GnuPG-bug-id: 6550
2023-12-19 13:12:59 +01:00
Ingo Klöcker
963ace1f9f
core: Support direct signing of file with gpg
* src/gpgme.h.in (GPGME_SIG_MODE_FILE): New signature mode flag.
* src/engine-gpg.c (gpg_sign): Separate signature mode from additional
flags. Check for incompatible flags. Explicitly set output to stdout if
no output file is used. Pass filename instead of fd to gpg when new flag
is set.
* src/engine-gpgsm.c (gpgsm_sign): Return error if new flag is set.
* src/engine-uiserver.c (uiserver_sign): Ditto.
* src/sign.c (sign_start): Consider new flag on check for invalid flags.

* tests/run-sign.c (show_usage): New options --detach and
--direct-file-io.
(main): Parse new options. Create a detached signature if --detach is
given. Make gpg read the input file itself if --direct-file-io is given.
--

With this change the gpgme_op_sign* functions gain the possibility to
make gpg read the data to sign directly from a file instead of from an
input FD to which it is written by gpgme.

GnuPG-bug-id: 6550
2023-12-19 13:09:33 +01:00
Ingo Klöcker
0221d7f28a
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
2023-12-19 13:07:45 +01:00
Ingo Klöcker
b35bcf0040
doc: Fix documentation for creating encrypted/signed archive
--

The previous paragraph already explains where/how the result is stored.
In particular, it's not always "returned in the data object ...".
2023-12-14 09:29:43 +01:00
Ingo Klöcker
d5dafb2ae3
qt: Replace Q_FOREACH with range-for
* lang/qt/src/qgpgmekeyformailboxjob.cpp (do_work): Replace Q_FOREACH
with range-for.
* lang/qt/src/qgpgmekeylistjob.cpp (QGpgMEKeyListJob::resultHook):
Ditto.
* lang/qt/src/threadedjobmixin.cpp (_detail::audit_log_as_html): Ditto.
* lang/qt/tests/t-keylist.cpp (KeyListTest::testPubkeyAlgoAsString):
Ditto.
* lang/qt/tests/t-keylocate.cpp (KeyLocateTest::testDaneKeyLocate,
KeyLocateTest::testKeyLocateSingle): Ditto.
* lang/qt/src/qgpgmesignencryptjob.cpp (sign_encrypt): Replace Q_FOREACH
with range-for. Add braces around single statement blocks.
* lang/qt/src/qgpgmesignjob.cpp (sign): Ditto.
* lang/qt/src/qgpgmenewcryptoconfig.cpp
(QGpgMENewCryptoConfig::reloadConfiguration,
QGpgMENewCryptoConfig::sync,
QGpgMENewCryptoConfigComponent::setComponent,
QGpgMENewCryptoConfigEntry::urlValueList,
QGpgMENewCryptoConfigEntry::setURLValueList): Replace Q_FOREACH with
range-for. Fix indentation. Add braces around single statement blocks.
--

Where necessary the iterated object is wrapped with qAsConst to avoid
deep copies of the iterated object.
2023-12-13 13:16:21 +01:00
Ingo Klöcker
f7d69de030
qt: Replace Q_NULLPTR with nullptr
* lang/qt/src/defaultkeygenerationjob.h, lang/qt/src/qgpgmebackend.h,
lang/qt/src/quickjob.h, lang/qt/src/threadedjobmixin.h: Replace all
occurrences of Q_NULLPTR with nullptr.
--
2023-12-13 13:04:32 +01:00
Andre Heinecke
6baccdc0c3
core: percent decode filename
* src/op-support.c (_gpgme_parse_plaintext): Decode filename
as percent string.

--
From gnupg/doc/DETAILS:

    If a filename is available it gets printed as the third
    argument, percent-escaped as usual.

so we can use the usual percent decode function here.

GnuPG-Bug-Id: T6852
2023-11-30 00:06:08 +01:00
Werner Koch
f212de4a9e
Post release updates
--
2023-11-28 16:48:37 +01:00
Werner Koch
1a26db7175
Release 1.23.2 2023-11-28 16:42:59 +01:00
Ingo Klöcker
1bbe2d4b70
qt: Start dirmngr with gpgconf to avoid multiple instances
* lang/qt/src/qgpgmewkdlookupjob.cpp (startDirmngr): Use "gpgconf
--launch dirmngr" to start dirmngr.
--

Using gpgconf to start dirmngr prevents multiple instances to be started
by the concurrently running keyserver lookup and WKD lookup.

GnuPG-bug-id: 6833
2023-11-23 16:13:39 +01:00
Ingo Klöcker
618fea9e20
qt: On Windows, use UTF-8 when logging the error text
* lang/qt/src/debug.cpp (operator<<): On Windows, interpret the error
text as UTF-8 instead of local 8-bit encoding.
--

GnuPG-bug-id: 5960
2023-11-15 11:57:18 +01:00
Ingo Klöcker
278f92b189
qt: Remove left-over partial files more persistently
* lang/qt/src/Makefile.am: Add new files.
* lang/qt/src/cleaner.cpp, lang/qt/src/cleaner.h: New.
* lang/qt/src/util.cpp (PartialFileGuard::~PartialFileGuard): Call
Cleaner::removeFile instead of removeFile.
* lang/qt/src/util.cpp, lang/qt/src/util.h (removeFile): Remove.
--

If the initial attempt to remove the file fails then a Cleaner is
created that tries to remove the file at regular intervals (10 s)
and on destruction (which happens on application shutdown).

GnuPG-bug-id: 6584
2023-11-15 11:57:18 +01:00
NIIBE Yutaka
185ab7d7ba
doc: Fix for e.g. and i.e.
--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2023-11-15 15:21:07 +09:00
Ingo Klöcker
77e982579c
core: Preserve more specific existing failure code
* src/decrypt.c (_gpgme_decrypt_status_handler): Ignore received failure
code if we already have a specific failure code.
* src/encrypt.c (_gpgme_encrypt_status_handler): Ditto.
* src/export.c (export_status_handler): Ditto.
* src/genkey.c (genkey_status_handler): Ditto.
* src/keylist.c (keylist_status_handler): Ditto.
* src/keysign.c (keysign_status_handler): Ditto.
* src/passwd.c (passwd_status_handler): Ditto.
* src/revsig.c (revsig_status_handler): Ditto.
* src/setexpire.c (setexpire_status_handler): Ditto.
* src/sign.c (_gpgme_sign_status_handler): Ditto.
* src/tofupolicy.c (tofu_policy_status_handler): Ditto.
* src/verify.c (_gpgme_verify_status_handler): Ditto.
--

Usually, a process emits at most one failure code. But some operations
like the creation of an encrypted archive involve multiple chained
processes, so that multiple failure codes can be received. We want to
keep the first specific failure code we received. Further failure codes
are only parsed if we received just an unspecific "general error" so
far.

GnuPG-bug-id: 6575
2023-11-14 13:51:24 +01:00
Werner Koch
1bfd5e92d0
tests: Add option --chain to run-keylist
* tests/run-keylist.c (xstrdup): New.
(main): Add option.
--

This allows to list the entire chain.
2023-11-10 09:45:35 +01:00