Commit Graph

3461 Commits

Author SHA1 Message Date
NIIBE Yutaka
b2a2158384 core: Support keylist mode for op_keylist_from_data.
* src/engine-backend.h (keylist_data): Add MODE argument.
* src/engine-gpg.c (gpg_keylist_data): Add MODE argument.
* src/engine.c (_gpgme_engine_op_keylist_data): Likewise.
* src/engine.h (_gpgme_engine_op_keylist_data): Declaration.
* src/keylist.c (gpgme_op_keylist_from_data_start): Call
_gpgme_engine_op_keylist_data with ctx->keylist_mode.

--

GnuPG-bug-id: 5438
Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2022-03-16 16:19:50 +09:00
Ingo Klöcker
55861ba9cc qt: Add missing include of config.h
* lang/qt/src/util.cpp: Include config.h.
--

GnuPG-bug-id: 5871
2022-03-07 09:28:09 +01:00
Ingo Klöcker
5a5a748e23 qt,doc: Remove comments about throwing exceptions
--

The jobs do not throw GpgME::Exception anymore since a long time.
2022-03-07 09:28:09 +01:00
Ingo Klöcker
71d4c9f452 doc: Update NEWS
--

Add a few more changes in version 1.17.0.
2022-03-07 09:28:09 +01:00
Werner Koch
f61a14f189
Post release updates 2022-03-06 18:02:42 +01:00
Werner Koch
ee50a38823
Release 1.17.1
* configure.ac: Bump QT LT version to C15/A0/R0.
2022-03-06 17:48:47 +01:00
Ingo Klöcker
ad3aabdd8a qt: Fix ABI compatibility with 1.16.0
* lang/qt/src/protocol.h (class Protocol): Move new virtual methods to
the end of the class.
--

This makes the vtable offsets of the old virtual methods match those
in 1.16.0 again.

GnuPG-bug-id: 5834
2022-02-17 09:54:45 +01:00
Werner Koch
fb5369161f
Post release updates
--
2022-02-07 18:09:06 +01:00
Werner Koch
72bb46b34f
Release 1.17.0 2022-02-07 15:02:49 +01:00
Werner Koch
451a42f0d2
qt: Fix build for older Qt versions.
* lang/qt/src/util.cpp: Include <functional>.
2022-02-07 13:10:13 +01:00
Ingo Klöcker
ca1c30b6fa qt: Add job to import keys given by key ids
* lang/qt/src/receivekeysjob.h, lang/qt/src/qgpgmereceivekeysjob.h,
lang/qt/src/qgpgmereceivekeysjob.cpp: New.
* lang/qt/src/protocol.h (class Protocol): Add pure virtual member
function receiveKeysJob.
* lang/qt/src/protocol_p.h (Protocol::receiveKeysJob): Implement it.
* lang/qt/src/job.cpp, lang/qt/src/Makefile.am: Update accordingly.

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

This job allows importing keys that are given by their key ids (or
fingerprints) from keyservers as with gpg's recv-keys command.

GnuPG-bug-id: 5808
2022-02-03 15:56:30 +01:00
Ingo Klöcker
ec8d1ee13f qt: Add helper for converting QStringList to vector of strings
* lang/qt/src/util.h, lang/qt/src/util.cpp: New.
* lang/qt/src/Makefile.am (qgpgme_sources, private_qgpgme_headers):
Add new files.
--

Additionally to the internal helper function toStrings(), this adds
a copy of the internal make_error helper of GpgME++ which is used
in a few places by QGpgME. We use the same error source id as GpgME++.

GnuPG-bug-id: 5808
2022-02-03 15:56:30 +01:00
Ingo Klöcker
bbaeeb5b9d cpp: Allow import of keys given by key ids
* lang/cpp/src/context.h (class Context): Add overloads of member
functions importKeys and startKeyImport
* lang/cpp/src/context.cpp (class Context): ... and implement them.
--

GnuPG-bug-id: 5808
2022-02-03 15:56:30 +01:00
Ingo Klöcker
3d7810e8d9 cpp: Add internal adapter for passing a vector of strings to gpgme
* lang/cpp/src/util.h (class StringsToCStrings): New.
* lang/cpp/src/util.cpp: New.
* lang/cpp/src/Makefile.am: Add new file.
--

This adapter simplifies passing a vector of strings as NULL-terminated
array of const char* to the C-interface of gpgme.

GnuPG-bug-id: 5808
2022-02-03 15:56:30 +01:00
Ingo Klöcker
3c2cff74b5 core: New function gpgme_op_receive_keys
* src/gpgme.h.in (gpgme_op_receive_keys_start, gpgme_op_receive_keys):
New.
* src/gpgme.def, src/libgpgme.vers: Add them.
* src/engine-backend.h (struct engine_ops): Add arg keyids to field
'import'.
* src/engine.h, src/engine.c (_gpgme_engine_op_import): Add arg keyids.
* src/engine.c (_gpgme_engine_op_import): Forward new arg keyids.
* src/import.c: (_gpgme_op_import_start, _gpgme_op_import_keys_start):
Pass NULL to new arg of _gpgme_op_import_start.
(_gpgme_op_receive_keys_start, gpgme_op_receive_keys_start,
gpgme_op_receive_keys): New.
* src/engine-gpg.c (gpg_import): Add arg keyids. Extend check for
valid arguments. Build command line if keyids are given.
* src/engine-gpgsm.c (gpgsm_import): Add arg keyids. Return error if
keyids is not NULL.

tests/run-receive-keys.c: New.
tests/Makefile.am (noinst_PROGRAMS): Add new test runner.
--

The new function allows importing keys given by their key ids or
fingerprints from a keyserver (like gpg's --recv-keys command).

GnuPG-bug-id: 5808
2022-02-03 15:56:30 +01:00
Werner Koch
5bb4174efa
doc: Fixed type of an object member
--

GnuPG-bug-id: 5719
2022-01-20 20:36:03 +01:00
Ingo Klöcker
ec71eb1d7d qt: Remove superfluous include
* lang/qt/src/importjob.h: Remove include of QByteArray.
--

QByteArray is included by other headers already. Besides: Qt headers
shouldn't be included with the package/module prefixes.
2022-01-17 14:44:57 +01:00
Ingo Klöcker
9c03bde06b qt: Fix build without installed GpgME++ headers
* lang/qt/src/importjob.h, lang/qt/src/wkdlookupresult.h: Include
headers of GpgME++ without "gpgme++/" prefix when building QGpgme.
* lang/qt/src/qgpgmeimportjob.cpp, lang/qt/src/qgpgmewkdlookupjob.cpp,
lang/qt/src/wkdlookupresult.cpp, lang/qt/tests/t-import.cpp: Include
headers of GpgME++ without "gpgme++/" prefix.
--
2022-01-17 14:41:17 +01:00
Ingo Klöcker
e16729edcb tests: Fix generation of keys without expiration
* tests/run-genkey.c (parse_expire_string): Support default expiration
and no expiration. Set flag for no expiration.
(main): Allow update of flags when generating new key.
--

This makes the parsing of different values for expiration match the
parsing done by gpg's --quick-gen-key. In particular, this makes it
possible again to generate keys without expiration.
2022-01-13 16:30:56 +01:00
Ingo Klöcker
e4625885a8 tests: Remove unsupported option --status from usage help
* tests/run-swdb.c (show_usage): Remove option --status.
--

run-swdb does not support the option --status.
2022-01-13 15:23:43 +01:00
Ingo Klöcker
4d913a8aa5 qt: Add job to add existing subkeys to other keys
* lang/qt/src/addexistingsubkeyjob.h,
lang/qt/src/qgpgmeaddexistingsubkeyjob.cpp,
lang/qt/src/qgpgmeaddexistingsubkeyjob.h: New.
* lang/qt/src/protocol.h (class Protocol): Add pure virtual member
function addExistingSubkeyJob.
* lang/qt/src/protocol_p.h (Protocol::addExistingSubkeyJob): Implement.
* lang/qt/src/job.cpp, lang/qt/src/Makefile.am: Update accordingly.

* lang/qt/tests/Makefile.am (the_tests, moc_files, noinst_PROGRAMS):
Add new test.
(t_addexistingsubkey_SOURCES): New.
* lang/qt/tests/t-addexistingsubkey.cpp: New.
* lang/qt/tests/t-support.h (VERIFY_OR_RETURN_VALUE,
COMPARE_OR_RETURN_VALUE, VERIFY_OR_OBJECT, COMPARE_OR_OBJECT,
VERIFY_OR_FALSE, COMPARE_OR_FALSE): New.
* lang/qt/tests/t-support.h, lang/qt/tests/t-support.cpp
(class QQGpgMETest): New member function importSecretKeys.
--

The new job allows adding existing subkeys to other keys as with the
"addkey" edit-key command of gpg. The added subkey will have the same
expiration date (+/- 1 second) as the original subkey.

GnuPG-bug-id: 5770
2022-01-13 15:18:12 +01:00
Ingo Klöcker
d308910cdf qt,tests: Add helper to hook up the test passphrase provider
* lang/qt/tests/t-support.h, lang/qt/tests/t-support.cpp
(class QGpgMETest): Add member function hookUpPassphraseProvider.
Add member mPassphraseProvider.
* lang/qt/tests/t-changeexpiryjob.cpp,
lang/qt/tests/t-encrypt.cpp,
lang/qt/tests/t-remarks.cpp,
lang/qt/tests/t-tofuinfo.cpp,
lang/qt/tests/t-trustsignatures.cpp,
lang/qt/tests/t-various.cpp: Use new helper.
--

GnuPG-bug-id: 5770
2022-01-13 12:40:35 +01:00
Ingo Klöcker
a54402fc2d qt,tests: Add asyncDone signal to base class of all tests
* lang/qt/tests/t-support.h (class QGpgMETest): Add signal asyncDone.
* lang/qt/tests/t-changeexpiryjob.cpp,
lang/qt/tests/t-encrypt.cpp,
lang/qt/tests/t-import.cpp,
lang/qt/tests/t-keylist.cpp,
lang/qt/tests/t-keylocate.cpp,
lang/qt/tests/t-ownertrust.cpp,
lang/qt/tests/t-remarks.cpp,
lang/qt/tests/t-tofuinfo.cpp,
lang/qt/tests/t-trustsignatures.cpp,
lang/qt/tests/t-various.cpp,
lang/qt/tests/t-wkdlookup.cpp,
lang/qt/tests/t-wkspublish.cpp: Remove signal asyncDone from the test
classes.
--

This reduces duplication and makes it possible to use the signal in
the base class.

GnuPG-bug-id: 5770
2022-01-13 11:36:35 +01:00
Ingo Klöcker
a4dcb17486 cpp: Add interactor to add existing subkeys to other keys
* lang/cpp/src/gpgaddexistingsubkeyeditinteractor.cpp,
lang/cpp/src/gpgaddexistingsubkeyeditinteractor.h: New.
* lang/cpp/src/Makefile.am: Add new files.
--

GnuPG-bug-id: 5770
2022-01-12 16:38:58 +01:00
Ingo Klöcker
a527bd7cf5 core: Return an error for secret key export operations
src/export.c (export_status_handler): Handle "export_keys.secret".
--

This allows callers of the synchronous export operations to react
properly to errors (e.g. wrong passphrase) during the export of secret
keys.

GnuPG-bug-id: 5766
2022-01-10 12:34:49 +01:00
Ingo Klöcker
062e4b1f0f doc: Update NEWS
--

GnuPG-bug-id: 5757
2022-01-04 16:08:35 +01:00
Ingo Klöcker
04723a6e96 qt: Add factory function for secret subkey export job
* lang/qt/src/protocol.h (class Protocol): Add member function
secretSubkeyExportJob.
* lang/qt/src/protocol_p.h (Protocol::secretSubkeyExportJob): Implement.

* lang/qt/tests/run-exportjob.cpp (showUsageAndExitWithCode): Print
new option.
(createExportJob): Create secret subkey export job if requested.
(main): New option --secret-subkey.
--

GnuPG-bug-id: 5757
2022-01-04 15:56:34 +01:00
Ingo Klöcker
e5c7fc3e02 cpp: Allow export of secret subkeys
* lang/cpp/src/context.h (enum Context::ExportMode): Add value
ExportSecretSubkey.
(class Context): Add member functions exportSecretSubkeys and
startSecretSubkeyExport.
* lang/cpp/src/context.cpp (Context::exportPublicKeys,
Context::startPublicKeyExport): Return error if ExportSecretSubkey
mode flag is set.
(Context::exportSecretSubkeys, Context::startSecretSubkeyExport):
Implement.
--

GnuPG-bug-id: 5757
2022-01-04 15:50:59 +01:00
Ingo Klöcker
88ad37ea96 qt: Remove obsolete QGpgMESecretKeyExportJob
* lang/qt/src/Makefile.am: Remove all occurrences of
qgpgmesecretkeyexportjob.*.
* lang/qt/src/qgpgmesecretkeyexportjob.cpp,
lang/qt/src/qgpgmesecretkeyexportjob.h: Remove.
--

QGpgMESecretKeyExportJob is an internal class, so that we can safely
remove it.

GnuPG-bug-id: 5757
2022-01-04 15:45:59 +01:00
Ingo Klöcker
4e80563fab qt: Use QGpgMEExportJob also for export of secret keys
* lang/qt/src/protocol.h (Protocol::secretKeyExportJob): Document
charset argument as ignored.
* lang/qt/src/protocol_p.h (Protocol::secretKeyExportJob): Use
QGpgMEExportJob instead of QGpgMESecretKeyExportJob.
* lang/qt/src/qgpgmeexportjob.h (class QGpgMEExportJob): Add c'tor
taking an export mode. Add member m_exportMode. Rename member m_flags to
m_additionalExportModeFlags.
(QGpgMEExportJob::~QGpgMEExportJob): Mark as override.
* lang/qt/src/qgpgmeexportjob.cpp (QGpgMEExportJob::QGpgMEExportJob):
Delegate to new c'tor. Implement new c'tor.
(QGpgMEExportJob::~QGpgMEExportJob): Use default.
(export_qba): Rename argument flags to mode.
(QGpgMEExportJob::start): Pass combination of export mode and additional
mode flags to export_qba.
(QGpgMEExportJob::setExportFlags): Adapt to renaming of member.

* lang/qt/tests/run-exportjob.cpp: New.
--

This change makes it possible to export secret OpenPGP keys.

GnuPG-bug-id: 5757
2022-01-04 15:44:16 +01:00
Ingo Klöcker
3da06d1096 cpp: Allow export of secret keys
* lang/cpp/src/context.h (class Context): New member functions
exportSecretKeys, startSecretKeyExport, exportKeys, startKeyExport.
(Context::exportPublicKeys, Context::startPublicKeyExport): Rename
argument flags/export_mode to mode.
* lang/cpp/src/context.cpp (Context::exportPublicKeys): Return error if
ExportSecret mode flag is set. Call exportKeys().
(Context::startPublicKeyExport): Return error if
ExportSecret mode flag is set. Call startKeyExport().
(Context::exportSecretKeys, Context::startSecretKeyExport,
Context::exportKeys, Context::startKeyExport): Implement.
--

This adds export functions for secret key exports and generic export
functions that can be used for any key export supported by
gpgme_op_export[_ext][_start].

GnuPG-bug-id: 5757
2022-01-04 15:44:16 +01:00
Ingo Klöcker
4888191014 cpp: Mark ExportNoUID flag as obsolete
* lang/cpp/src/context.h (enum Context::ExportMode): Mark value
ExportNoUID as obsolete
--

GnuPG-bug-id: 5757
2022-01-04 14:55:30 +01:00
Ingo Klöcker
2752e81f89 core: Add new option --secret-subkey to help texts.
* src/gpgme-tool.c (hlp_export): Add new option.
* tests/run-export.c (show_usage): Print new option.
--

GnuPG-bug-id: 5757
2022-01-04 12:30:22 +01:00
Ingo Klöcker
fa5f1b57cc cpp: Remove obsolete workaround
* lang/cpp/src/context.cpp (Context::startKeyListing,
Context::exportPublicKeys, Context::startPublicKeyExport): Remove
workaround.
--

gpgme_op_keylist_ext[_start] supports GPGME_KEYLIST_MODE_EXTERN
since a long time. And the export doesn't use a keylisting (anymore),
so that the keylisting mode is irrelevant for the export.

GnuPG-bug-id: 5757
2022-01-04 09:56:46 +01:00
Ingo Klöcker
0e19c48791 core: New export mode to export secret subkeys.
* 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
2022-01-04 09:23:40 +01:00
Ingo Klöcker
414bbdd53c doc: Remove documentation of obsolete export mode flag
* doc/gpgme.texi: Remove GPGME_EXPORT_MODE_NOUID.
--

Support for this experimental flag has been removed with revision
c8fd8870b3.

GnuPG-bug-id: 5757
2022-01-04 09:23:27 +01:00
Ingo Klöcker
c710af223c core: Check for unsupported export mode flags
src/engine-gpgsm.c (gpgsm_export, gpgsm_export_ext): Return error if an
unsupported mode flag is set.
--

The minimal mode flag has no effect for X.509 certificates, but we still
treat it as supported (as documented in the API documentation).

GnuPG-bug-id: 5757
2022-01-04 09:22:46 +01:00
Ingo Klöcker
c0581adabe core: Check for combination of ssh mode with other mode flags
* src/export.c (check_mode): Return error if ssh mode is combined with
another mode flag.
--

The SSH mode flag cannot be used in combination with other flags.

GnuPG-bug-id: 5757
2022-01-04 09:22:25 +01:00
Ingo Klöcker
3268575115 core: Factor out the check for valid export mode flags.
* src/export.c (check_mode): New.
(export_start, export_ext_start): Call check_mode.
--

GnuPG-bug-id: 5757
2022-01-04 09:21:37 +01:00
Ingo Klöcker
82f43455e9 qt: Detect an import error caused by a wrong password
* lang/qt/src/qgpgmeimportjob.cpp (import_qba): Check import statuses of
import result for bad passphrase errors.
--

To allow users of the import job to handle a failed import caused by
a wrong password more gracefully, check if all import statuses of the
import result have a bad passphrase error and return a bad passphrase
error as import result in this case.

GnuPG-bug-id: 5713
2021-12-22 15:25:42 +01:00
Ingo Klöcker
f99451e20f qt,tests: Add test runner for testing the import job
* lang/qt/tests/Makefile.am (run_importjob_SOURCES): New.
(noinst_PROGRAMS): Add run-importjob.
* lang/qt/tests/run-importjob.cpp: New.
--

GnuPG-bug-id: 5713
2021-12-22 15:25:42 +01:00
Ingo Klöcker
300776f391 cpp: Check fpr of import status for NULL
* lang/cpp/src/importresult.cpp (GpgME::ImportResult::Private): Check
fpr for NULL.
--

GnuPG-bug-id: 5713
2021-12-22 15:25:42 +01:00
Ingo Klöcker
305d8668ca core: Detect bad passphrase error on certificate import
* src/import.c (gpgme_op_import_result): Check fpr for NULL.
(parse_error): New.
(import_status_handler): Handle error status line.

* doc/gpgme.texi (gpgme_import_status_t): Mention that fpr can be NULL.

* tests/gpg/t-import.c (check_result): Check fpr for NULL.
* tests/run-threaded.c (delete_impres): Check fpr for NULL.
--

When importing an encrypted certificate a wrong passphrase may be
entered. In this case gpgsm emits a status line with a bad passphrase
error and an "invalid object" error. To make it possible for callers
to handle a wrong passphrase error more gracefully, an import status
with bad passphrase error is added to the import result for each
status line with bad passphrase error.

GnuPG-bug-id: 5713
2021-12-22 15:25:42 +01:00
NIIBE Yutaka
0636e229d7 build: Update for newer autoconf.
* configure.ac (AC_PREREQ): Require >= 2.69.
(AC_CONFIG_HEADERS): Use it instead of AC_CONFIG_HEADER.

--

Signed-off-by: NIIBE Yutaka <gniibe@fsij.org>
2021-12-22 09:27:06 +09:00
Ingo Klöcker
619579bb17 qt: Allow specifying an import filter when importing keys
* lang/qt/src/importjob.cpp (struct ImportJobPrivate): Add member
m_importFilter.
* lang/qt/src/importjob.cpp, lang/qt/src/importjob.h (class ImportJob):
Add member functions setImportFilter and importFilter.
* lang/qt/src/qgpgmeimportjob.cpp (import_qba): Add arg importFilter
and adjust the callers. Set import filter context flag.

* lang/qt/tests/t-import.cpp (ImportTest): Add member function
testImportWithImportFilter.
--

GnuPG-bug-id: 5739
2021-12-15 15:00:07 +01:00
Ingo Klöcker
3e81a4a336 qt: Avoid test failure when test is run multiple times
* lang/qt/tests/t-import.cpp (ImportTest): Add member tempGpgHome and
member function initTestCase.
(keyFpr, keyData): Move to ImportTest::testImportWithKeyOrigin.
--

Use different temporary GNUPGHOME's when running the test. This ensures
that the import in the test is always done with a new keyring.

GnuPG-bug-id: 5733
2021-12-15 12:21:28 +01:00
Ingo Klöcker
3c770013d7 qt: Fix erroneous reuse of JobPrivate objects
* lang/qt/src/job.cpp (Job::~Job): Destroy JobPrivate object belonging
to destroyed job.
--

In some tests different Job objects reused the same JobPrivate object
because they were created with the same memory address. Obviously, this
shouldn't happen.

GnuPG-bug-id: 5739
2021-12-15 12:00:51 +01:00
Ingo Klöcker
d35d44efaf core: Allow setting import filters when importing keys
* src/context.h (struct gpgme_context): New field import_filter.
* src/engine-backend.h (struct engine_ops): Add arg import_filter to
field 'import'.
* src/engine-gpg.c (gpg_import): Add arg import_filter and pass option
--import-filter with argument value to gpg. Adjust all callers.
* src/engine-gpgsm.c (gpgsm_import): Add dummy arg import_filter.
* src/gpgme.c (gpgme_release): Free 'import_filter'.
(gpgme_set_ctx_flag, gpgme_get_ctx_flag): New flag "import-filter".

* tests/run-import.c (main): Add option --import-filter.
--

This makes the --import-filter option available in the GPGME API for
key imports.

GnuPG-bug-id: 5739
2021-12-14 15:44:37 +01:00
Ingo Klöcker
af820811ec qt: Add pattern used for WKD lookup to result
* lang/qt/src/qgpgmewkdlookupjob.cpp (run_wkd_get): Change type of
arg email.
(lookup_keys): Add pattern to result.
* lang/qt/src/wkdlookupresult.h (class WKDLookupResult): Add arg
pattern to c'tors. Add member function pattern.
* lang/qt/src/wkdlookupresult.cpp (class WKDLookupResult::Private):
Add field pattern.
(WKDLookupResult::WKDLookupResult): Pass pattern to pimpl.
(WKDLookupResult::pattern): New.

* lang/qt/tests/t-wkdlookup.cpp (testWKDLookupAsync, testWKDLookupSync,
testLookupWithNoResultAsync): Check pattern.
--

GnuPG-bug-id: 5728
2021-12-14 14:49:39 +01:00
Ingo Klöcker
fd680254da core: Set --key-origin option only if supported by gpg
* src/engine-gpg.c (gpg_import): Do not pass --key-origin option to
gpg if gpg is too old.
--

GnuPG-bug-id: 5733
2021-12-14 14:41:23 +01:00