summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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 ed51225f3..c5570c8d6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
120010425
2 - OpenBSD CVS Sync
3 - markus@cvs.openbsd.org 2001/04/23 21:57:07
4 [ssh-keygen.1 ssh-keygen.c]
5 allow public key for -e, too
6
120010424 720010424
2 - OpenBSD CVS Sync 8 - OpenBSD CVS Sync
3 - markus@cvs.openbsd.org 2001/04/22 23:58:36 9 - markus@cvs.openbsd.org 2001/04/22 23:58:36
@@ -5236,4 +5242,4 @@
5236 - Wrote replacements for strlcpy and mkdtemp 5242 - Wrote replacements for strlcpy and mkdtemp
5237 - Released 1.0pre1 5243 - Released 1.0pre1
5238 5244
5239$Id: ChangeLog,v 1.1165 2001/04/24 00:03:58 mouring Exp $ 5245$Id: ChangeLog,v 1.1166 2001/04/24 16:56:58 mouring Exp $
diff --git a/ssh-keygen.1 b/ssh-keygen.1
index 613bc95d7..371fc5fe4 100644
--- a/ssh-keygen.1
+++ b/ssh-keygen.1
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ssh-keygen.1,v 1.39 2001/04/22 23:58:36 markus Exp $ 1.\" $OpenBSD: ssh-keygen.1,v 1.40 2001/04/23 21:57:07 markus Exp $
2.\" 2.\"
3.\" -*- nroff -*- 3.\" -*- nroff -*-
4.\" 4.\"
@@ -145,7 +145,8 @@ Requests changing the comment in the private and public key files.
145The program will prompt for the file containing the private keys, for 145The program will prompt for the file containing the private keys, for
146passphrase if the key has one, and for the new comment. 146passphrase if the key has one, and for the new comment.
147.It Fl e 147.It Fl e
148This option will read a private OpenSSH key file and print the key in a 148This option will read a private or public OpenSSH key file and
149print the key in a
149.Sq SECSH Public Key File Format 150.Sq SECSH Public Key File Format
150to stdout. 151to stdout.
151This option allows exporting keys for use by several commercial 152This option allows exporting keys for use by several commercial
diff --git a/ssh-keygen.c b/ssh-keygen.c
index 5549376fd..8daa52833 100644
--- a/ssh-keygen.c
+++ b/ssh-keygen.c
@@ -12,7 +12,7 @@
12 */ 12 */
13 13
14#include "includes.h" 14#include "includes.h"
15RCSID("$OpenBSD: ssh-keygen.c,v 1.58 2001/04/22 13:41:02 markus Exp $"); 15RCSID("$OpenBSD: ssh-keygen.c,v 1.59 2001/04/23 21:57:07 markus Exp $");
16 16
17#include <openssl/evp.h> 17#include <openssl/evp.h>
18#include <openssl/pem.h> 18#include <openssl/pem.h>
@@ -136,7 +136,7 @@ try_load_pem_key(char *filename)
136void 136void
137do_convert_to_ssh2(struct passwd *pw) 137do_convert_to_ssh2(struct passwd *pw)
138{ 138{
139 Key *prv; 139 Key *k;
140 int len; 140 int len;
141 u_char *blob; 141 u_char *blob;
142 struct stat st; 142 struct stat st;
@@ -147,20 +147,21 @@ do_convert_to_ssh2(struct passwd *pw)
147 perror(identity_file); 147 perror(identity_file);
148 exit(1); 148 exit(1);
149 } 149 }
150 prv = try_load_pem_key(identity_file); 150 if ((k = key_load_public(identity_file, NULL)) == NULL) {
151 if (prv == NULL) { 151 if ((k = try_load_pem_key(identity_file)) == NULL) {
152 fprintf(stderr, "load failed\n"); 152 fprintf(stderr, "load failed\n");
153 exit(1); 153 exit(1);
154 }
154 } 155 }
155 key_to_blob(prv, &blob, &len); 156 key_to_blob(k, &blob, &len);
156 fprintf(stdout, "%s\n", SSH_COM_PUBLIC_BEGIN); 157 fprintf(stdout, "%s\n", SSH_COM_PUBLIC_BEGIN);
157 fprintf(stdout, 158 fprintf(stdout,
158 "Comment: \"%d-bit %s, converted from OpenSSH by %s@%s\"\n", 159 "Comment: \"%d-bit %s, converted from OpenSSH by %s@%s\"\n",
159 key_size(prv), key_type(prv), 160 key_size(k), key_type(k),
160 pw->pw_name, hostname); 161 pw->pw_name, hostname);
161 dump_base64(stdout, blob, len); 162 dump_base64(stdout, blob, len);
162 fprintf(stdout, "%s\n", SSH_COM_PUBLIC_END); 163 fprintf(stdout, "%s\n", SSH_COM_PUBLIC_END);
163 key_free(prv); 164 key_free(k);
164 xfree(blob); 165 xfree(blob);
165 exit(0); 166 exit(0);
166} 167}