diff options
author | Werner Koch <[email protected]> | 2016-01-08 16:22:32 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 2016-01-08 16:22:32 +0000 |
commit | 4970868d8d84d3a64b067e5aafc9f097621758d3 (patch) | |
tree | aeee7248153198e8165421721bb23597d17176b1 /g10/gpg.c | |
parent | gpg: Add an exact search flag to the PK struct. (diff) | |
download | gnupg-4970868d8d84d3a64b067e5aafc9f097621758d3.tar.gz gnupg-4970868d8d84d3a64b067e5aafc9f097621758d3.zip |
gpg: New command --export-ssh-key
* g10/export.c: Include membuf.h and host2net.h.
(key_to_sshblob): New.
(export_ssh_key): New.
* g10/gpg.c (aExportSshKey): New.
(opts): Add command.
(main): Implement that command.
--
GnuPG-bug-id: 2212
I have done only a few tests rights now and the ECDSA curves do not
yet work. However ssh-keygen -l accept RSA and ed25519 keys exported
using this command.
Signed-off-by: Werner Koch <[email protected]>
Diffstat (limited to '')
-rw-r--r-- | g10/gpg.c | 16 |
1 files changed, 15 insertions, 1 deletions
@@ -1,6 +1,6 @@ /* gpg.c - The GnuPG utility (main for gpg) * Copyright (C) 1998-2011 Free Software Foundation, Inc. - * Copyright (C) 1997-2014 Werner Koch + * Copyright (C) 1997-2016 Werner Koch * Copyright (C) 2015 g10 Code GmbH * * This file is part of GnuPG. @@ -141,6 +141,7 @@ enum cmd_and_opt_values aExport, aExportSecret, aExportSecretSub, + aExportSshKey, aCheckKeys, aGenRevoke, aDesigRevoke, @@ -453,6 +454,7 @@ static ARGPARSE_OPTS opts[] = { ARGPARSE_c (aFetchKeys, "fetch-keys" , "@" ), ARGPARSE_c (aExportSecret, "export-secret-keys" , "@" ), ARGPARSE_c (aExportSecretSub, "export-secret-subkeys" , "@" ), + ARGPARSE_c (aExportSshKey, "export-ssh-key", "@" ), ARGPARSE_c (aImport, "import", N_("import/merge keys")), ARGPARSE_c (aFastImport, "fast-import", "@"), #ifdef ENABLE_CARD_SUPPORT @@ -2400,6 +2402,7 @@ main (int argc, char **argv) case aListSigs: case aExportSecret: case aExportSecretSub: + case aExportSshKey: case aSym: case aClearsign: case aGenRevoke: @@ -4184,6 +4187,17 @@ main (int argc, char **argv) free_strlist(sl); break; + case aExportSshKey: + if (argc != 1) + wrong_args ("--export-ssh-key <user-id>"); + rc = export_ssh_key (ctrl, argv[0]); + if (rc) + { + write_status_failure ("export-ssh-key", rc); + log_error (_("export as ssh key failed: %s\n"), gpg_strerror (rc)); + } + break; + case aSearchKeys: sl = NULL; for (; argc; argc--, argv++) |