summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--ssh-keygen.110
-rw-r--r--ssh-keygen.c51
3 files changed, 31 insertions, 36 deletions
diff --git a/ChangeLog b/ChangeLog
index fbf2d6cde..d80d65de2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -25,6 +25,10 @@
25 - markus@cvs.openbsd.org 2001/03/11 18:29:51 25 - markus@cvs.openbsd.org 2001/03/11 18:29:51
26 [key.c] 26 [key.c]
27 style+cleanup 27 style+cleanup
28 - markus@cvs.openbsd.org 2001/03/11 22:33:24
29 [ssh-keygen.1 ssh-keygen.c]
30 remove -v again. use -B instead for bubblebabble. make -B consistent
31 with -l and make -B work with /path/to/known_hosts. ok deraadt@
28 32
2920010311 3320010311
30 - OpenBSD CVS Sync 34 - OpenBSD CVS Sync
@@ -4518,4 +4522,4 @@
4518 - Wrote replacements for strlcpy and mkdtemp 4522 - Wrote replacements for strlcpy and mkdtemp
4519 - Released 1.0pre1 4523 - Released 1.0pre1
4520 4524
4521$Id: ChangeLog,v 1.946 2001/03/12 02:59:31 mouring Exp $ 4525$Id: ChangeLog,v 1.947 2001/03/12 03:02:17 mouring Exp $
diff --git a/ssh-keygen.1 b/ssh-keygen.1
index d6ad33d6a..a3914680e 100644
--- a/ssh-keygen.1
+++ b/ssh-keygen.1
@@ -1,4 +1,4 @@
1.\" $OpenBSD: ssh-keygen.1,v 1.34 2001/03/11 15:04:16 jakob Exp $ 1.\" $OpenBSD: ssh-keygen.1,v 1.35 2001/03/11 22:33:23 markus Exp $
2.\" 2.\"
3.\" -*- nroff -*- 3.\" -*- nroff -*-
4.\" 4.\"
@@ -72,7 +72,9 @@
72.Op Fl f Ar keyfile 72.Op Fl f Ar keyfile
73.Nm ssh-keygen 73.Nm ssh-keygen
74.Fl l 74.Fl l
75.Op Fl v 75.Op Fl f Ar input_keyfile
76.Nm ssh-keygen
77.Fl B
76.Op Fl f Ar input_keyfile 78.Op Fl f Ar input_keyfile
77.Sh DESCRIPTION 79.Sh DESCRIPTION
78.Nm 80.Nm
@@ -167,14 +169,14 @@ or
167for protocol version 2. 169for protocol version 2.
168The default is 170The default is
169.Dq rsa1 . 171.Dq rsa1 .
172.It Fl B
173Show the bubblebabble digest of specified private or public key file.
170.It Fl C Ar comment 174.It Fl C Ar comment
171Provides the new comment. 175Provides the new comment.
172.It Fl N Ar new_passphrase 176.It Fl N Ar new_passphrase
173Provides the new passphrase. 177Provides the new passphrase.
174.It Fl P Ar passphrase 178.It Fl P Ar passphrase
175Provides the (old) passphrase. 179Provides the (old) passphrase.
176.It Fl v
177Print verbose information.
178.It Fl x 180.It Fl x
179This option will read a private 181This option will read a private
180OpenSSH DSA format file and print a SSH2-compatible public key to stdout. 182OpenSSH DSA format file and print a SSH2-compatible public key to stdout.
diff --git a/ssh-keygen.c b/ssh-keygen.c
index f4f700f79..45a511477 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.48 2001/03/11 16:39:03 deraadt Exp $"); 15RCSID("$OpenBSD: ssh-keygen.c,v 1.49 2001/03/11 22:33:24 markus Exp $");
16 16
17#include <openssl/evp.h> 17#include <openssl/evp.h>
18#include <openssl/pem.h> 18#include <openssl/pem.h>
@@ -46,6 +46,7 @@ int quiet = 0;
46 46
47/* Flag indicating that we just want to see the key fingerprint */ 47/* Flag indicating that we just want to see the key fingerprint */
48int print_fingerprint = 0; 48int print_fingerprint = 0;
49int print_bubblebabble = 0;
49 50
50/* The identity file name, given on the command line or entered by the user. */ 51/* The identity file name, given on the command line or entered by the user. */
51char identity_file[1024]; 52char identity_file[1024];
@@ -64,7 +65,6 @@ char *identity_comment = NULL;
64int convert_to_ssh2 = 0; 65int convert_to_ssh2 = 0;
65int convert_from_ssh2 = 0; 66int convert_from_ssh2 = 0;
66int print_public = 0; 67int print_public = 0;
67int print_verbose = 0;
68 68
69/* default to RSA for SSH-1 */ 69/* default to RSA for SSH-1 */
70char *key_type_name = "rsa1"; 70char *key_type_name = "rsa1";
@@ -326,13 +326,15 @@ do_print_public(struct passwd *pw)
326void 326void
327do_fingerprint(struct passwd *pw) 327do_fingerprint(struct passwd *pw)
328{ 328{
329
330 FILE *f; 329 FILE *f;
331 Key *public; 330 Key *public;
332 char *comment = NULL, *cp, *ep, line[16*1024]; 331 char *comment = NULL, *cp, *ep, line[16*1024], *fp;
333 int i, skip = 0, num = 1, invalid = 1, success = 0; 332 int i, skip = 0, num = 1, invalid = 1, success = 0, rep, type;
334 struct stat st; 333 struct stat st;
335 334
335 type = print_bubblebabble ? SSH_FP_SHA1 : SSH_FP_MD5;
336 rep = print_bubblebabble ? SSH_FP_BUBBLEBABBLE : SSH_FP_HEX;
337
336 if (!have_identity) 338 if (!have_identity)
337 ask_filename(pw, "Enter file in which the key is"); 339 ask_filename(pw, "Enter file in which the key is");
338 if (stat(identity_file, &st) < 0) { 340 if (stat(identity_file, &st) < 0) {
@@ -351,26 +353,12 @@ do_fingerprint(struct passwd *pw)
351 debug("try_load_public_key KEY_UNSPEC failed"); 353 debug("try_load_public_key KEY_UNSPEC failed");
352 } 354 }
353 if (success) { 355 if (success) {
354 char *digest_md5, *digest_bubblebabble; 356 fp = key_fingerprint_ex(public, type, rep);
355 357 printf("%d %s %s\n", key_size(public),
356 digest_md5 = key_fingerprint_ex(public, SSH_FP_MD5, SSH_FP_HEX); 358 fp, comment);
357 digest_bubblebabble = key_fingerprint_ex(public, SSH_FP_SHA1,
358 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("bubblebabble: %s\n", digest_bubblebabble);
365 } else {
366 printf("%d %s %s\n", key_size(public), digest_md5, comment);
367 }
368
369 key_free(public); 359 key_free(public);
370 xfree(comment); 360 xfree(comment);
371 xfree(digest_md5); 361 xfree(fp);
372 xfree(digest_bubblebabble);
373
374 exit(0); 362 exit(0);
375 } 363 }
376 364
@@ -421,9 +409,10 @@ do_fingerprint(struct passwd *pw)
421 } 409 }
422 } 410 }
423 comment = *cp ? cp : comment; 411 comment = *cp ? cp : comment;
424 printf("%d %s %s\n", key_size(public), 412 fp = key_fingerprint_ex(public, type, rep);
425 key_fingerprint(public), 413 printf("%d %s %s\n", key_size(public), fp,
426 comment ? comment : "no comment"); 414 comment ? comment : "no comment");
415 xfree(fp);
427 invalid = 0; 416 invalid = 0;
428 } 417 }
429 fclose(f); 418 fclose(f);
@@ -664,7 +653,7 @@ main(int ac, char **av)
664 exit(1); 653 exit(1);
665 } 654 }
666 655
667 while ((opt = getopt(ac, av, "dqpclRxXyvb:f:t:P:N:C:")) != -1) { 656 while ((opt = getopt(ac, av, "dqpclBRxXyb:f:t:P:N:C:")) != -1) {
668 switch (opt) { 657 switch (opt) {
669 case 'b': 658 case 'b':
670 bits = atoi(optarg); 659 bits = atoi(optarg);
@@ -678,6 +667,10 @@ main(int ac, char **av)
678 print_fingerprint = 1; 667 print_fingerprint = 1;
679 break; 668 break;
680 669
670 case 'B':
671 print_bubblebabble = 1;
672 break;
673
681 case 'p': 674 case 'p':
682 change_passphrase = 1; 675 change_passphrase = 1;
683 break; 676 break;
@@ -724,10 +717,6 @@ main(int ac, char **av)
724 print_public = 1; 717 print_public = 1;
725 break; 718 break;
726 719
727 case 'v':
728 print_verbose = 1;
729 break;
730
731 case 'd': 720 case 'd':
732 key_type_name = "dsa"; 721 key_type_name = "dsa";
733 break; 722 break;
@@ -749,7 +738,7 @@ main(int ac, char **av)
749 printf("Can only have one of -p and -c.\n"); 738 printf("Can only have one of -p and -c.\n");
750 usage(); 739 usage();
751 } 740 }
752 if (print_fingerprint) 741 if (print_fingerprint || print_bubblebabble)
753 do_fingerprint(pw); 742 do_fingerprint(pw);
754 if (change_passphrase) 743 if (change_passphrase)
755 do_change_passphrase(pw); 744 do_change_passphrase(pw);