summaryrefslogtreecommitdiff
path: root/ssh-keygen.c
diff options
context:
space:
mode:
Diffstat (limited to 'ssh-keygen.c')
-rw-r--r--ssh-keygen.c28
1 files changed, 16 insertions, 12 deletions
diff --git a/ssh-keygen.c b/ssh-keygen.c
index 057803351..87be6a5f8 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.37 2000/12/22 16:49:40 markus Exp $"); 15RCSID("$OpenBSD: ssh-keygen.c,v 1.38 2000/12/28 18:58:39 markus Exp $");
16 16
17#include <openssl/evp.h> 17#include <openssl/evp.h>
18#include <openssl/pem.h> 18#include <openssl/pem.h>
@@ -332,7 +332,6 @@ do_fingerprint(struct passwd *pw)
332 Key *public; 332 Key *public;
333 char *comment = NULL, *cp, *ep, line[16*1024]; 333 char *comment = NULL, *cp, *ep, line[16*1024];
334 int i, skip = 0, num = 1, invalid = 1, success = 0; 334 int i, skip = 0, num = 1, invalid = 1, success = 0;
335 u_int ignore;
336 struct stat st; 335 struct stat st;
337 336
338 if (!have_identity) 337 if (!have_identity)
@@ -350,7 +349,7 @@ do_fingerprint(struct passwd *pw)
350 if (try_load_public_key(identity_file, public, &comment)) 349 if (try_load_public_key(identity_file, public, &comment))
351 success = 1; 350 success = 1;
352 else 351 else
353 error("try_load_public_key KEY_UNSPEC failed"); 352 debug("try_load_public_key KEY_UNSPEC failed");
354 } 353 }
355 if (success) { 354 if (success) {
356 printf("%d %s %s\n", key_size(public), key_fingerprint(public), comment); 355 printf("%d %s %s\n", key_size(public), key_fingerprint(public), comment);
@@ -359,9 +358,6 @@ do_fingerprint(struct passwd *pw)
359 exit(0); 358 exit(0);
360 } 359 }
361 360
362 /* XXX RSA1 only */
363
364 public = key_new(KEY_RSA1);
365 f = fopen(identity_file, "r"); 361 f = fopen(identity_file, "r");
366 if (f != NULL) { 362 if (f != NULL) {
367 while (fgets(line, sizeof(line), f)) { 363 while (fgets(line, sizeof(line), f)) {
@@ -398,13 +394,21 @@ do_fingerprint(struct passwd *pw)
398 *cp++ = '\0'; 394 *cp++ = '\0';
399 } 395 }
400 ep = cp; 396 ep = cp;
401 if (auth_rsa_read_key(&cp, &ignore, public->rsa->e, public->rsa->n)) { 397 public = key_new(KEY_RSA1);
402 invalid = 0; 398 if (key_read(public, &cp) != 1) {
403 comment = *cp ? cp : comment; 399 cp = ep;
404 printf("%d %s %s\n", key_size(public), 400 key_free(public);
405 key_fingerprint(public), 401 public = key_new(KEY_UNSPEC);
406 comment ? comment : "no comment"); 402 if (key_read(public, &cp) != 1) {
403 key_free(public);
404 continue;
405 }
407 } 406 }
407 comment = *cp ? cp : comment;
408 printf("%d %s %s\n", key_size(public),
409 key_fingerprint(public),
410 comment ? comment : "no comment");
411 invalid = 0;
408 } 412 }
409 fclose(f); 413 fclose(f);
410 } 414 }