version 1.372, 2019/11/25 00:55:58 |
version 1.374, 2019/12/10 22:37:20 |
|
|
int r, i, fd, found, agent_fd = -1; |
int r, i, fd, found, agent_fd = -1; |
u_int n; |
u_int n; |
struct sshkey *ca, *public; |
struct sshkey *ca, *public; |
char valid[64], *otmp, *tmp, *cp, *out, *comment, **plist = NULL; |
char valid[64], *otmp, *tmp, *cp, *out, *comment; |
|
char *ca_fp = NULL, **plist = NULL; |
FILE *f; |
FILE *f; |
struct ssh_identitylist *agent_ids; |
struct ssh_identitylist *agent_ids; |
size_t j; |
size_t j; |
|
struct notifier_ctx *notifier = NULL; |
|
|
#ifdef ENABLE_PKCS11 |
#ifdef ENABLE_PKCS11 |
pkcs11_init(1); |
pkcs11_init(1); |
|
|
fatal("CA key type %s doesn't match specified %s", |
fatal("CA key type %s doesn't match specified %s", |
sshkey_ssh_name(ca), key_type_name); |
sshkey_ssh_name(ca), key_type_name); |
} |
} |
|
ca_fp = sshkey_fingerprint(ca, fingerprint_hash, SSH_FP_DEFAULT); |
|
|
for (i = 0; i < argc; i++) { |
for (i = 0; i < argc; i++) { |
/* Split list of principals */ |
/* Split list of principals */ |
|
|
fatal("Couldn't certify key %s via agent: %s", |
fatal("Couldn't certify key %s via agent: %s", |
tmp, ssh_err(r)); |
tmp, ssh_err(r)); |
} else { |
} else { |
if ((r = sshkey_certify(public, ca, key_type_name, |
if (sshkey_is_sk(ca) && |
sk_provider)) != 0) |
(ca->sk_flags & SSH_SK_USER_PRESENCE_REQD)) { |
|
notifier = notify_start(0, |
|
"Confirm user presence for key %s %s", |
|
sshkey_type(ca), ca_fp); |
|
} |
|
r = sshkey_certify(public, ca, key_type_name, |
|
sk_provider); |
|
notify_complete(notifier); |
|
if (r != 0) |
fatal("Couldn't certify key %s: %s", |
fatal("Couldn't certify key %s: %s", |
tmp, ssh_err(r)); |
tmp, ssh_err(r)); |
} |
} |
|
|
if (cert_serial_autoinc) |
if (cert_serial_autoinc) |
cert_serial++; |
cert_serial++; |
} |
} |
|
free(ca_fp); |
#ifdef ENABLE_PKCS11 |
#ifdef ENABLE_PKCS11 |
pkcs11_terminate(); |
pkcs11_terminate(); |
#endif |
#endif |
|
|
switch (type) { |
switch (type) { |
case KEY_ECDSA_SK: |
case KEY_ECDSA_SK: |
case KEY_ED25519_SK: |
case KEY_ED25519_SK: |
|
if (!quiet) { |
|
printf("You may need to touch your security key " |
|
"to authorize key generation.\n"); |
|
} |
|
fflush(stdout); |
if (sshsk_enroll(type, sk_provider, |
if (sshsk_enroll(type, sk_provider, |
cert_key_id == NULL ? "ssh:" : cert_key_id, |
cert_key_id == NULL ? "ssh:" : cert_key_id, |
sk_flags, NULL, &private, NULL) != 0) |
sk_flags, NULL, &private, NULL) != 0) |