diff options
author | Ingo Klöcker <[email protected]> | 2022-01-03 15:25:40 +0000 |
---|---|---|
committer | Ingo Klöcker <[email protected]> | 2022-01-04 08:23:40 +0000 |
commit | 0e19c4879193ed7fa61ad5d488f237b2b5b5d1d7 (patch) | |
tree | 597edbb9f50c2a2f874d9b1f56592ab7bb4c900e /tests/run-export.c | |
parent | doc: Remove documentation of obsolete export mode flag (diff) | |
download | gpgme-0e19c4879193ed7fa61ad5d488f237b2b5b5d1d7.tar.gz gpgme-0e19c4879193ed7fa61ad5d488f237b2b5b5d1d7.zip |
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
Diffstat (limited to 'tests/run-export.c')
-rw-r--r-- | tests/run-export.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/run-export.c b/tests/run-export.c index 623c7331..f071b8c2 100644 --- a/tests/run-export.c +++ b/tests/run-export.c @@ -128,6 +128,11 @@ main (int argc, char **argv) mode |= GPGME_EXPORT_MODE_SECRET; argc--; argv++; } + else if (!strcmp (*argv, "--secret-subkey")) + { + mode |= GPGME_EXPORT_MODE_SECRET_SUBKEY; + argc--; argv++; + } else if (!strcmp (*argv, "--raw")) { mode |= GPGME_EXPORT_MODE_RAW; @@ -168,6 +173,16 @@ main (int argc, char **argv) err = gpgme_op_export_ext (ctx, (const char**)argv, mode, out); fail_if_err (err); } + else if ((mode & GPGME_EXPORT_MODE_SECRET_SUBKEY)) + { + keyarray[0] = NULL; + + printf ("exporting secret subkeys!\n"); + + gpgme_set_armor (ctx, 1); + err = gpgme_op_export_ext (ctx, (const char**)argv, mode, out); + fail_if_err (err); + } else { /* Lookup the keys as required by the export_keys function. */ |