summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Lindstrom <mouring@eviladmin.org>2001-04-24 16:56:58 +0000
committerBen Lindstrom <mouring@eviladmin.org>2001-04-24 16:56:58 +0000
commit46c264f2ae6e74c1ea218dd3a8717695c5c8d680 (patch)
tree397b7e92d288cd174733a51179788f830ca98596
parent4adb091c2925ab055016a27142a5cb258527ee9e (diff)
- markus@cvs.openbsd.org 2001/04/23 21:57:07
[ssh-keygen.1 ssh-keygen.c] allow public key for -e, too
-rw-r--r--ChangeLog8
-rw-r--r--ssh-keygen.15
-rw-r--r--ssh-keygen.c19
3 files changed, 20 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index ed51225f..c5570c8d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+20010425
+ - OpenBSD CVS Sync
+ - markus@cvs.openbsd.org 2001/04/23 21:57:07
+ [ssh-keygen.1 ssh-keygen.c]
+ allow public key for -e, too
+
20010424
- OpenBSD CVS Sync
- markus@cvs.openbsd.org 2001/04/22 23:58:36
@@ -5236,4 +5242,4 @@
- Wrote replacements for strlcpy and mkdtemp
- Released 1.0pre1
-$Id: ChangeLog,v 1.1165 2001/04/24 00:03:58 mouring Exp $
+$Id: ChangeLog,v 1.1166 2001/04/24 16:56:58 mouring Exp $
diff --git a/ssh-keygen.1 b/ssh-keygen.1
index 613bc95d..371fc5fe 100644
--- a/ssh-keygen.1
+++ b/ssh-keygen.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: ssh-keygen.1,v 1.39 2001/04/22 23:58:36 markus Exp $
+.\" $OpenBSD: ssh-keygen.1,v 1.40 2001/04/23 21:57:07 markus Exp $
.\"
.\" -*- nroff -*-
.\"
@@ -145,7 +145,8 @@ Requests changing the comment in the private and public key files.
The program will prompt for the file containing the private keys, for
passphrase if the key has one, and for the new comment.
.It Fl e
-This option will read a private OpenSSH key file and print the key in a
+This option will read a private or public OpenSSH key file and
+print the key in a
.Sq SECSH Public Key File Format
to stdout.
This option allows exporting keys for use by several commercial
diff --git a/ssh-keygen.c b/ssh-keygen.c
index 5549376f..8daa5283 100644
--- a/ssh-keygen.c
+++ b/ssh-keygen.c
@@ -12,7 +12,7 @@
*/
#include "includes.h"
-RCSID("$OpenBSD: ssh-keygen.c,v 1.58 2001/04/22 13:41:02 markus Exp $");
+RCSID("$OpenBSD: ssh-keygen.c,v 1.59 2001/04/23 21:57:07 markus Exp $");
#include <openssl/evp.h>
#include <openssl/pem.h>
@@ -136,7 +136,7 @@ try_load_pem_key(char *filename)
void
do_convert_to_ssh2(struct passwd *pw)
{
- Key *prv;
+ Key *k;
int len;
u_char *blob;
struct stat st;
@@ -147,20 +147,21 @@ do_convert_to_ssh2(struct passwd *pw)
perror(identity_file);
exit(1);
}
- prv = try_load_pem_key(identity_file);
- if (prv == NULL) {
- fprintf(stderr, "load failed\n");
- exit(1);
+ if ((k = key_load_public(identity_file, NULL)) == NULL) {
+ if ((k = try_load_pem_key(identity_file)) == NULL) {
+ fprintf(stderr, "load failed\n");
+ exit(1);
+ }
}
- key_to_blob(prv, &blob, &len);
+ key_to_blob(k, &blob, &len);
fprintf(stdout, "%s\n", SSH_COM_PUBLIC_BEGIN);
fprintf(stdout,
"Comment: \"%d-bit %s, converted from OpenSSH by %s@%s\"\n",
- key_size(prv), key_type(prv),
+ key_size(k), key_type(k),
pw->pw_name, hostname);
dump_base64(stdout, blob, len);
fprintf(stdout, "%s\n", SSH_COM_PUBLIC_END);
- key_free(prv);
+ key_free(k);
xfree(blob);
exit(0);
}