Home GnuPG
Diffusion GPGME 3c2cff74b535

core: New function gpgme_op_receive_keys


core: New function gpgme_op_receive_keys

* src/gpgme.h.in (gpgme_op_receive_keys_start, gpgme_op_receive_keys):
* src/gpgme.def, src/libgpgme.vers: Add them.
* src/engine-backend.h (struct engine_ops): Add arg keyids to field
* 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).