version 1.257, 2015/01/18 21:51:19 |
version 1.260, 2015/01/30 00:59:19 |
|
|
fatal("%s: unknown key format %d", __func__, convert_format); |
fatal("%s: unknown key format %d", __func__, convert_format); |
} |
} |
|
|
if (!private) |
if (!private) { |
if ((r = sshkey_write(k, stdout)) == 0) |
if ((r = sshkey_write(k, stdout)) == 0) |
ok = 1; |
ok = 1; |
if (ok) |
if (ok) |
fprintf(stdout, "\n"); |
fprintf(stdout, "\n"); |
else { |
} else { |
switch (k->type) { |
switch (k->type) { |
case KEY_DSA: |
case KEY_DSA: |
ok = PEM_write_DSAPrivateKey(stdout, k->dsa, NULL, |
ok = PEM_write_DSAPrivateKey(stdout, k->dsa, NULL, |
|
|
fp = sshkey_fingerprint(keys[i], fptype, rep); |
fp = sshkey_fingerprint(keys[i], fptype, rep); |
ra = sshkey_fingerprint(keys[i], fingerprint_hash, |
ra = sshkey_fingerprint(keys[i], fingerprint_hash, |
SSH_FP_RANDOMART); |
SSH_FP_RANDOMART); |
|
if (fp == NULL || ra == NULL) |
|
fatal("%s: sshkey_fingerprint fail", __func__); |
printf("%u %s %s (PKCS11 key)\n", sshkey_size(keys[i]), |
printf("%u %s %s (PKCS11 key)\n", sshkey_size(keys[i]), |
fp, sshkey_type(keys[i])); |
fp, sshkey_type(keys[i])); |
if (log_level >= SYSLOG_LEVEL_VERBOSE) |
if (log_level >= SYSLOG_LEVEL_VERBOSE) |
|
|
fp = sshkey_fingerprint(public, fptype, rep); |
fp = sshkey_fingerprint(public, fptype, rep); |
ra = sshkey_fingerprint(public, fingerprint_hash, |
ra = sshkey_fingerprint(public, fingerprint_hash, |
SSH_FP_RANDOMART); |
SSH_FP_RANDOMART); |
|
if (fp == NULL || ra == NULL) |
|
fatal("%s: sshkey_fingerprint fail", __func__); |
printf("%u %s %s (%s)\n", sshkey_size(public), fp, comment, |
printf("%u %s %s (%s)\n", sshkey_size(public), fp, comment, |
sshkey_type(public)); |
sshkey_type(public)); |
if (log_level >= SYSLOG_LEVEL_VERBOSE) |
if (log_level >= SYSLOG_LEVEL_VERBOSE) |
|
|
fp = sshkey_fingerprint(public, fptype, rep); |
fp = sshkey_fingerprint(public, fptype, rep); |
ra = sshkey_fingerprint(public, fingerprint_hash, |
ra = sshkey_fingerprint(public, fingerprint_hash, |
SSH_FP_RANDOMART); |
SSH_FP_RANDOMART); |
|
if (fp == NULL || ra == NULL) |
|
fatal("%s: sshkey_fingerprint fail", __func__); |
printf("%u %s %s (%s)\n", sshkey_size(public), fp, |
printf("%u %s %s (%s)\n", sshkey_size(public), fp, |
comment ? comment : "no comment", sshkey_type(public)); |
comment ? comment : "no comment", sshkey_type(public)); |
if (log_level >= SYSLOG_LEVEL_VERBOSE) |
if (log_level >= SYSLOG_LEVEL_VERBOSE) |
|
|
static void |
static void |
do_known_hosts(struct passwd *pw, const char *name) |
do_known_hosts(struct passwd *pw, const char *name) |
{ |
{ |
char *cp, tmp[MAXPATHLEN], old[MAXPATHLEN]; |
char *cp, tmp[PATH_MAX], old[PATH_MAX]; |
int r, fd, oerrno, inplace = 0; |
int r, fd, oerrno, inplace = 0; |
struct known_hosts_ctx ctx; |
struct known_hosts_ctx ctx; |
|
|
|
|
key_fp = sshkey_fingerprint(key, fingerprint_hash, SSH_FP_DEFAULT); |
key_fp = sshkey_fingerprint(key, fingerprint_hash, SSH_FP_DEFAULT); |
ca_fp = sshkey_fingerprint(key->cert->signature_key, |
ca_fp = sshkey_fingerprint(key->cert->signature_key, |
fingerprint_hash, SSH_FP_DEFAULT); |
fingerprint_hash, SSH_FP_DEFAULT); |
|
if (key_fp == NULL || ca_fp == NULL) |
|
fatal("%s: sshkey_fingerprint fail", __func__); |
|
|
printf("%s:\n", identity_file); |
printf("%s:\n", identity_file); |
printf(" Type: %s %s certificate\n", sshkey_ssh_name(key), |
printf(" Type: %s %s certificate\n", sshkey_ssh_name(key), |
|
|
{ |
{ |
char dotsshdir[PATH_MAX], comment[1024], *passphrase1, *passphrase2; |
char dotsshdir[PATH_MAX], comment[1024], *passphrase1, *passphrase2; |
char *checkpoint = NULL; |
char *checkpoint = NULL; |
char out_file[PATH_MAX], *rr_hostname = NULL, *ep; |
char out_file[PATH_MAX], *rr_hostname = NULL, *ep, *fp, *ra; |
struct sshkey *private, *public; |
struct sshkey *private, *public; |
struct passwd *pw; |
struct passwd *pw; |
struct stat st; |
struct stat st; |
|
|
fclose(f); |
fclose(f); |
|
|
if (!quiet) { |
if (!quiet) { |
char *fp = sshkey_fingerprint(public, fingerprint_hash, |
fp = sshkey_fingerprint(public, fingerprint_hash, |
SSH_FP_DEFAULT); |
SSH_FP_DEFAULT); |
char *ra = sshkey_fingerprint(public, fingerprint_hash, |
ra = sshkey_fingerprint(public, fingerprint_hash, |
SSH_FP_RANDOMART); |
SSH_FP_RANDOMART); |
|
if (fp == NULL || ra == NULL) |
|
fatal("sshkey_fingerprint failed"); |
printf("Your public key has been saved in %s.\n", |
printf("Your public key has been saved in %s.\n", |
identity_file); |
identity_file); |
printf("The key fingerprint is:\n"); |
printf("The key fingerprint is:\n"); |