aboutsummaryrefslogtreecommitdiffstats
path: root/src/engine-gpg.c
diff options
context:
space:
mode:
authorWerner Koch <[email protected]>2020-07-16 10:00:46 +0000
committerWerner Koch <[email protected]>2020-07-16 10:00:46 +0000
commit7f9e0ca57b29cc96bd1ca717d891c11db7435c5a (patch)
tree626649d39737ff25e85c035e64777b8898cf03fe /src/engine-gpg.c
parentcore: Deprecate the non-working trustlist functions. (diff)
downloadgpgme-7f9e0ca57b29cc96bd1ca717d891c11db7435c5a.tar.gz
gpgme-7f9e0ca57b29cc96bd1ca717d891c11db7435c5a.zip
core: New export mode to export as OpenSSH public key.
* src/gpgme.h.in (GPGME_EXPORT_MODE_SSH): New. * src/export.c (export_ext_start): Allow for new mode. * src/engine-gpg.c (export_common): Implement. * tests/run-export.c (status_cb): New. (main): New options --status and --ssh. -- GnuPG-bug-id: 4310 Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to 'src/engine-gpg.c')
-rw-r--r--src/engine-gpg.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/engine-gpg.c b/src/engine-gpg.c
index 9362e297..af2533d8 100644
--- a/src/engine-gpg.c
+++ b/src/engine-gpg.c
@@ -2330,6 +2330,7 @@ export_common (engine_gpg_t gpg, gpgme_export_mode_t mode,
if ((mode & ~(GPGME_EXPORT_MODE_EXTERN
|GPGME_EXPORT_MODE_MINIMAL
+ |GPGME_EXPORT_MODE_SSH
|GPGME_EXPORT_MODE_SECRET)))
return gpg_error (GPG_ERR_NOT_SUPPORTED);
@@ -2345,6 +2346,15 @@ export_common (engine_gpg_t gpg, gpgme_export_mode_t mode,
if (err)
;
+ else if ((mode & GPGME_EXPORT_MODE_SSH))
+ {
+ if (have_gpg_version (gpg, "2.1.11"))
+ err = add_arg (gpg, "--export-ssh-key");
+ else
+ err = gpg_error (GPG_ERR_NOT_SUPPORTED);
+ if (!err)
+ err = add_data (gpg, keydata, 1, 1);
+ }
else if ((mode & GPGME_EXPORT_MODE_EXTERN))
{
err = add_arg (gpg, "--send-keys");