summaryrefslogtreecommitdiff
path: root/ssh-keygen.c
diff options
context:
space:
mode:
Diffstat (limited to 'ssh-keygen.c')
-rw-r--r--ssh-keygen.c19
1 files changed, 7 insertions, 12 deletions
diff --git a/ssh-keygen.c b/ssh-keygen.c
index 8a03f0d8d..83450fe84 100644
--- a/ssh-keygen.c
+++ b/ssh-keygen.c
@@ -7,7 +7,7 @@
7 */ 7 */
8 8
9#include "includes.h" 9#include "includes.h"
10RCSID("$OpenBSD: ssh-keygen.c,v 1.29 2000/07/15 04:01:37 djm Exp $"); 10RCSID("$OpenBSD: ssh-keygen.c,v 1.30 2000/08/19 21:34:43 markus Exp $");
11 11
12#include <openssl/evp.h> 12#include <openssl/evp.h>
13#include <openssl/pem.h> 13#include <openssl/pem.h>
@@ -16,7 +16,6 @@ RCSID("$OpenBSD: ssh-keygen.c,v 1.29 2000/07/15 04:01:37 djm Exp $");
16 16
17#include "ssh.h" 17#include "ssh.h"
18#include "xmalloc.h" 18#include "xmalloc.h"
19#include "fingerprint.h"
20#include "key.h" 19#include "key.h"
21#include "rsa.h" 20#include "rsa.h"
22#include "dsa.h" 21#include "dsa.h"
@@ -228,8 +227,9 @@ do_print_public(struct passwd *pw)
228void 227void
229do_fingerprint(struct passwd *pw) 228do_fingerprint(struct passwd *pw)
230{ 229{
230 /* XXX RSA1 only */
231
231 FILE *f; 232 FILE *f;
232 BIGNUM *e, *n;
233 Key *public; 233 Key *public;
234 char *comment = NULL, *cp, *ep, line[16*1024]; 234 char *comment = NULL, *cp, *ep, line[16*1024];
235 int i, skip = 0, num = 1, invalid = 1; 235 int i, skip = 0, num = 1, invalid = 1;
@@ -249,13 +249,9 @@ do_fingerprint(struct passwd *pw)
249 key_free(public); 249 key_free(public);
250 exit(0); 250 exit(0);
251 } 251 }
252 key_free(public);
253 252
254 /* XXX */
255 f = fopen(identity_file, "r"); 253 f = fopen(identity_file, "r");
256 if (f != NULL) { 254 if (f != NULL) {
257 n = BN_new();
258 e = BN_new();
259 while (fgets(line, sizeof(line), f)) { 255 while (fgets(line, sizeof(line), f)) {
260 i = strlen(line) - 1; 256 i = strlen(line) - 1;
261 if (line[i] != '\n') { 257 if (line[i] != '\n') {
@@ -290,18 +286,17 @@ do_fingerprint(struct passwd *pw)
290 *cp++ = '\0'; 286 *cp++ = '\0';
291 } 287 }
292 ep = cp; 288 ep = cp;
293 if (auth_rsa_read_key(&cp, &ignore, e, n)) { 289 if (auth_rsa_read_key(&cp, &ignore, public->rsa->e, public->rsa->n)) {
294 invalid = 0; 290 invalid = 0;
295 comment = *cp ? cp : comment; 291 comment = *cp ? cp : comment;
296 printf("%d %s %s\n", BN_num_bits(n), 292 printf("%d %s %s\n", key_size(public),
297 fingerprint(e, n), 293 key_fingerprint(public),
298 comment ? comment : "no comment"); 294 comment ? comment : "no comment");
299 } 295 }
300 } 296 }
301 BN_free(e);
302 BN_free(n);
303 fclose(f); 297 fclose(f);
304 } 298 }
299 key_free(public);
305 if (invalid) { 300 if (invalid) {
306 printf("%s is not a valid key file.\n", identity_file); 301 printf("%s is not a valid key file.\n", identity_file);
307 exit(1); 302 exit(1);