summaryrefslogtreecommitdiff
path: root/ssh-keygen.c
diff options
context:
space:
mode:
Diffstat (limited to 'ssh-keygen.c')
-rw-r--r--ssh-keygen.c30
1 files changed, 27 insertions, 3 deletions
diff --git a/ssh-keygen.c b/ssh-keygen.c
index dbb46ac90..af59bcf6e 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.46 2001/03/09 03:14:39 deraadt Exp $"); 15RCSID("$OpenBSD: ssh-keygen.c,v 1.47 2001/03/11 15:04:16 jakob Exp $");
16 16
17#include <openssl/evp.h> 17#include <openssl/evp.h>
18#include <openssl/pem.h> 18#include <openssl/pem.h>
@@ -64,6 +64,7 @@ char *identity_comment = NULL;
64int convert_to_ssh2 = 0; 64int convert_to_ssh2 = 0;
65int convert_from_ssh2 = 0; 65int convert_from_ssh2 = 0;
66int print_public = 0; 66int print_public = 0;
67int print_verbose = 0;
67 68
68/* default to RSA for SSH-1 */ 69/* default to RSA for SSH-1 */
69char *key_type_name = "rsa1"; 70char *key_type_name = "rsa1";
@@ -350,9 +351,28 @@ do_fingerprint(struct passwd *pw)
350 debug("try_load_public_key KEY_UNSPEC failed"); 351 debug("try_load_public_key KEY_UNSPEC failed");
351 } 352 }
352 if (success) { 353 if (success) {
353 printf("%d %s %s\n", key_size(public), key_fingerprint(public), comment); 354 char *digest_md5, *digest_sha1, *digest_bubblebabble;
355
356 digest_md5 = key_fingerprint_ex(public, SSH_FP_MD5, SSH_FP_HEX);
357 digest_sha1 = key_fingerprint_ex(public, SSH_FP_SHA1, SSH_FP_HEX);
358 digest_bubblebabble = key_fingerprint_ex(public, SSH_FP_SHA1, SSH_FP_BUBBLEBABBLE);
359
360 if(print_verbose) {
361 printf("comment: %s\n", comment);
362 printf("size: %d\n", key_size(public));
363 printf("md5: %s\n", digest_md5);
364 printf("sha1: %s\n", digest_sha1);
365 printf("bubblebabble: %s\n", digest_bubblebabble);
366 } else {
367 printf("%d %s %s\n", key_size(public), digest_md5, comment);
368 }
369
354 key_free(public); 370 key_free(public);
355 xfree(comment); 371 xfree(comment);
372 xfree(digest_md5);
373 xfree(digest_sha1);
374 xfree(digest_bubblebabble);
375
356 exit(0); 376 exit(0);
357 } 377 }
358 378
@@ -646,7 +666,7 @@ main(int ac, char **av)
646 exit(1); 666 exit(1);
647 } 667 }
648 668
649 while ((opt = getopt(ac, av, "dqpclRxXyb:f:t:P:N:C:")) != -1) { 669 while ((opt = getopt(ac, av, "dqpclRxXyvb:f:t:P:N:C:")) != -1) {
650 switch (opt) { 670 switch (opt) {
651 case 'b': 671 case 'b':
652 bits = atoi(optarg); 672 bits = atoi(optarg);
@@ -706,6 +726,10 @@ main(int ac, char **av)
706 print_public = 1; 726 print_public = 1;
707 break; 727 break;
708 728
729 case 'v':
730 print_verbose = 1;
731 break;
732
709 case 'd': 733 case 'd':
710 key_type_name = "dsa"; 734 key_type_name = "dsa";
711 break; 735 break;