|
Lines 45-50
Link Here
|
| 45 |
#include "ssh2.h" |
45 |
#include "ssh2.h" |
| 46 |
#include "atomicio.h" |
46 |
#include "atomicio.h" |
| 47 |
#include "krl.h" |
47 |
#include "krl.h" |
|
|
48 |
#include "digest.h" |
| 48 |
|
49 |
|
| 49 |
#ifdef ENABLE_PKCS11 |
50 |
#ifdef ENABLE_PKCS11 |
| 50 |
#include "ssh-pkcs11.h" |
51 |
#include "ssh-pkcs11.h" |
|
Lines 86-91
int show_cert = 0;
Link Here
|
| 86 |
int print_fingerprint = 0; |
87 |
int print_fingerprint = 0; |
| 87 |
int print_bubblebabble = 0; |
88 |
int print_bubblebabble = 0; |
| 88 |
|
89 |
|
|
|
90 |
/* Hash algorithm to use for fingerprints. */ |
| 91 |
int fingerprint_hash = SSH_FP_HASH_DEFAULT; |
| 92 |
|
| 89 |
/* The identity file name, given on the command line or entered by the user. */ |
93 |
/* The identity file name, given on the command line or entered by the user. */ |
| 90 |
char identity_file[1024]; |
94 |
char identity_file[1024]; |
| 91 |
int have_identity = 0; |
95 |
int have_identity = 0; |
|
Lines 737-747
do_download(struct passwd *pw)
Link Here
|
| 737 |
Key **keys = NULL; |
741 |
Key **keys = NULL; |
| 738 |
int i, nkeys; |
742 |
int i, nkeys; |
| 739 |
enum fp_rep rep; |
743 |
enum fp_rep rep; |
| 740 |
enum fp_type fptype; |
744 |
int fptype; |
| 741 |
char *fp, *ra; |
745 |
char *fp, *ra; |
| 742 |
|
746 |
|
| 743 |
fptype = print_bubblebabble ? SSH_FP_SHA1 : SSH_FP_MD5; |
747 |
fptype = print_bubblebabble ? SSH_DIGEST_SHA1 : fingerprint_hash; |
| 744 |
rep = print_bubblebabble ? SSH_FP_BUBBLEBABBLE : SSH_FP_HEX; |
748 |
rep = print_bubblebabble ? SSH_FP_BUBBLEBABBLE : SSH_FP_DEFAULT; |
| 745 |
|
749 |
|
| 746 |
pkcs11_init(0); |
750 |
pkcs11_init(0); |
| 747 |
nkeys = pkcs11_add_provider(pkcs11provider, NULL, &keys); |
751 |
nkeys = pkcs11_add_provider(pkcs11provider, NULL, &keys); |
|
Lines 750-756
do_download(struct passwd *pw)
Link Here
|
| 750 |
for (i = 0; i < nkeys; i++) { |
754 |
for (i = 0; i < nkeys; i++) { |
| 751 |
if (print_fingerprint) { |
755 |
if (print_fingerprint) { |
| 752 |
fp = key_fingerprint(keys[i], fptype, rep); |
756 |
fp = key_fingerprint(keys[i], fptype, rep); |
| 753 |
ra = key_fingerprint(keys[i], SSH_FP_MD5, |
757 |
ra = key_fingerprint(keys[i], fingerprint_hash, |
| 754 |
SSH_FP_RANDOMART); |
758 |
SSH_FP_RANDOMART); |
| 755 |
printf("%u %s %s (PKCS11 key)\n", key_size(keys[i]), |
759 |
printf("%u %s %s (PKCS11 key)\n", key_size(keys[i]), |
| 756 |
fp, key_type(keys[i])); |
760 |
fp, key_type(keys[i])); |
|
Lines 780-791
do_fingerprint(struct passwd *pw)
Link Here
|
| 780 |
char *comment = NULL, *cp, *ep, line[16*1024], *fp, *ra; |
784 |
char *comment = NULL, *cp, *ep, line[16*1024], *fp, *ra; |
| 781 |
int i, skip = 0, num = 0, invalid = 1; |
785 |
int i, skip = 0, num = 0, invalid = 1; |
| 782 |
enum fp_rep rep; |
786 |
enum fp_rep rep; |
| 783 |
enum fp_type fptype; |
787 |
int fptype; |
| 784 |
struct stat st; |
788 |
struct stat st; |
| 785 |
|
789 |
|
| 786 |
fptype = print_bubblebabble ? SSH_FP_SHA1 : SSH_FP_MD5; |
790 |
fptype = print_bubblebabble ? SSH_DIGEST_SHA1 : fingerprint_hash; |
| 787 |
rep = print_bubblebabble ? SSH_FP_BUBBLEBABBLE : SSH_FP_HEX; |
791 |
rep = print_bubblebabble ? SSH_FP_BUBBLEBABBLE : SSH_FP_DEFAULT; |
| 788 |
|
|
|
| 789 |
if (!have_identity) |
792 |
if (!have_identity) |
| 790 |
ask_filename(pw, "Enter file in which the key is"); |
793 |
ask_filename(pw, "Enter file in which the key is"); |
| 791 |
if (stat(identity_file, &st) < 0) { |
794 |
if (stat(identity_file, &st) < 0) { |
|
Lines 795-801
do_fingerprint(struct passwd *pw)
Link Here
|
| 795 |
public = key_load_public(identity_file, &comment); |
798 |
public = key_load_public(identity_file, &comment); |
| 796 |
if (public != NULL) { |
799 |
if (public != NULL) { |
| 797 |
fp = key_fingerprint(public, fptype, rep); |
800 |
fp = key_fingerprint(public, fptype, rep); |
| 798 |
ra = key_fingerprint(public, SSH_FP_MD5, SSH_FP_RANDOMART); |
801 |
ra = key_fingerprint(public, fingerprint_hash, |
|
|
802 |
SSH_FP_RANDOMART); |
| 799 |
printf("%u %s %s (%s)\n", key_size(public), fp, comment, |
803 |
printf("%u %s %s (%s)\n", key_size(public), fp, comment, |
| 800 |
key_type(public)); |
804 |
key_type(public)); |
| 801 |
if (log_level >= SYSLOG_LEVEL_VERBOSE) |
805 |
if (log_level >= SYSLOG_LEVEL_VERBOSE) |
|
Lines 861-867
do_fingerprint(struct passwd *pw)
Link Here
|
| 861 |
} |
865 |
} |
| 862 |
comment = *cp ? cp : comment; |
866 |
comment = *cp ? cp : comment; |
| 863 |
fp = key_fingerprint(public, fptype, rep); |
867 |
fp = key_fingerprint(public, fptype, rep); |
| 864 |
ra = key_fingerprint(public, SSH_FP_MD5, SSH_FP_RANDOMART); |
868 |
ra = key_fingerprint(public, fingerprint_hash, |
|
|
869 |
SSH_FP_RANDOMART); |
| 865 |
printf("%u %s %s (%s)\n", key_size(public), fp, |
870 |
printf("%u %s %s (%s)\n", key_size(public), fp, |
| 866 |
comment ? comment : "no comment", key_type(public)); |
871 |
comment ? comment : "no comment", key_type(public)); |
| 867 |
if (log_level >= SYSLOG_LEVEL_VERBOSE) |
872 |
if (log_level >= SYSLOG_LEVEL_VERBOSE) |
|
Lines 979-991
printhost(FILE *f, const char *name, Key *public, int ca, int revoked, int hash)
Link Here
|
| 979 |
{ |
984 |
{ |
| 980 |
if (print_fingerprint) { |
985 |
if (print_fingerprint) { |
| 981 |
enum fp_rep rep; |
986 |
enum fp_rep rep; |
| 982 |
enum fp_type fptype; |
987 |
int fptype; |
| 983 |
char *fp, *ra; |
988 |
char *fp, *ra; |
| 984 |
|
989 |
|
| 985 |
fptype = print_bubblebabble ? SSH_FP_SHA1 : SSH_FP_MD5; |
990 |
fptype = print_bubblebabble ? |
| 986 |
rep = print_bubblebabble ? SSH_FP_BUBBLEBABBLE : SSH_FP_HEX; |
991 |
SSH_DIGEST_SHA1 : fingerprint_hash; |
|
|
992 |
rep = print_bubblebabble ? SSH_FP_BUBBLEBABBLE : SSH_FP_DEFAULT; |
| 987 |
fp = key_fingerprint(public, fptype, rep); |
993 |
fp = key_fingerprint(public, fptype, rep); |
| 988 |
ra = key_fingerprint(public, SSH_FP_MD5, SSH_FP_RANDOMART); |
994 |
ra = key_fingerprint(public, fingerprint_hash, |
|
|
995 |
SSH_FP_RANDOMART); |
| 989 |
printf("%u %s %s (%s)\n", key_size(public), fp, name, |
996 |
printf("%u %s %s (%s)\n", key_size(public), fp, name, |
| 990 |
key_type(public)); |
997 |
key_type(public)); |
| 991 |
if (log_level >= SYSLOG_LEVEL_VERBOSE) |
998 |
if (log_level >= SYSLOG_LEVEL_VERBOSE) |
|
Lines 1894-1902
do_show_cert(struct passwd *pw)
Link Here
|
| 1894 |
fatal("%s is not a certificate", identity_file); |
1901 |
fatal("%s is not a certificate", identity_file); |
| 1895 |
v00 = key->type == KEY_RSA_CERT_V00 || key->type == KEY_DSA_CERT_V00; |
1902 |
v00 = key->type == KEY_RSA_CERT_V00 || key->type == KEY_DSA_CERT_V00; |
| 1896 |
|
1903 |
|
| 1897 |
key_fp = key_fingerprint(key, SSH_FP_MD5, SSH_FP_HEX); |
1904 |
key_fp = key_fingerprint(key, fingerprint_hash, SSH_FP_DEFAULT); |
| 1898 |
ca_fp = key_fingerprint(key->cert->signature_key, |
1905 |
ca_fp = key_fingerprint(key->cert->signature_key, |
| 1899 |
SSH_FP_MD5, SSH_FP_HEX); |
1906 |
fingerprint_hash, SSH_FP_DEFAULT); |
| 1900 |
|
1907 |
|
| 1901 |
printf("%s:\n", identity_file); |
1908 |
printf("%s:\n", identity_file); |
| 1902 |
printf(" Type: %s %s certificate\n", key_ssh_name(key), |
1909 |
printf(" Type: %s %s certificate\n", key_ssh_name(key), |
|
Lines 2240-2248
main(int argc, char **argv)
Link Here
|
| 2240 |
exit(1); |
2247 |
exit(1); |
| 2241 |
} |
2248 |
} |
| 2242 |
|
2249 |
|
| 2243 |
/* Remaining characters: EUYdw */ |
2250 |
/* Remaining characters: UYdw */ |
| 2244 |
while ((opt = getopt(argc, argv, "ABHLQXceghiklopquvxy" |
2251 |
while ((opt = getopt(argc, argv, "ABHLQXceghiklopquvxy" |
| 2245 |
"C:D:F:G:I:J:K:M:N:O:P:R:S:T:V:W:Z:a:b:f:g:j:m:n:r:s:t:z:")) != -1) { |
2252 |
"C:D:E:F:G:I:J:K:M:N:O:P:R:S:T:V:W:Z:" |
|
|
2253 |
"a:b:f:g:j:m:n:r:s:t:z:")) != -1) { |
| 2246 |
switch (opt) { |
2254 |
switch (opt) { |
| 2247 |
case 'A': |
2255 |
case 'A': |
| 2248 |
gen_all_hostkeys = 1; |
2256 |
gen_all_hostkeys = 1; |
|
Lines 2253-2258
main(int argc, char **argv)
Link Here
|
| 2253 |
fatal("Bits has bad value %s (%s)", |
2261 |
fatal("Bits has bad value %s (%s)", |
| 2254 |
optarg, errstr); |
2262 |
optarg, errstr); |
| 2255 |
break; |
2263 |
break; |
|
|
2264 |
case 'E': |
| 2265 |
fingerprint_hash = ssh_digest_alg_by_name(optarg); |
| 2266 |
if (fingerprint_hash == -1) |
| 2267 |
fatal("Invalid hash algorithm \"%s\"", optarg); |
| 2268 |
break; |
| 2256 |
case 'F': |
2269 |
case 'F': |
| 2257 |
find_host = 1; |
2270 |
find_host = 1; |
| 2258 |
rr_hostname = optarg; |
2271 |
rr_hostname = optarg; |
|
Lines 2684-2691
passphrase_again:
Link Here
|
| 2684 |
fclose(f); |
2697 |
fclose(f); |
| 2685 |
|
2698 |
|
| 2686 |
if (!quiet) { |
2699 |
if (!quiet) { |
| 2687 |
char *fp = key_fingerprint(public, SSH_FP_MD5, SSH_FP_HEX); |
2700 |
char *fp = key_fingerprint(public, fingerprint_hash, |
| 2688 |
char *ra = key_fingerprint(public, SSH_FP_MD5, |
2701 |
SSH_FP_DEFAULT); |
|
|
2702 |
char *ra = key_fingerprint(public, fingerprint_hash, |
| 2689 |
SSH_FP_RANDOMART); |
2703 |
SSH_FP_RANDOMART); |
| 2690 |
printf("Your public key has been saved in %s.\n", |
2704 |
printf("Your public key has been saved in %s.\n", |
| 2691 |
identity_file); |
2705 |
identity_file); |