diff options
Diffstat (limited to 'ssh-keygen.c')
-rw-r--r-- | ssh-keygen.c | 19 |
1 files changed, 10 insertions, 9 deletions
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" |
15 | RCSID("$OpenBSD: ssh-keygen.c,v 1.58 2001/04/22 13:41:02 markus Exp $"); | 15 | RCSID("$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) | |||
136 | void | 136 | void |
137 | do_convert_to_ssh2(struct passwd *pw) | 137 | do_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 | } |