version 1.22, 2015/09/02 07:51:12 |
version 1.23, 2015/09/13 14:39:16 |
|
|
sshkey_parse_private_fileblob_type(struct sshbuf *blob, int type, |
sshkey_parse_private_fileblob_type(struct sshbuf *blob, int type, |
const char *passphrase, struct sshkey **keyp, char **commentp) |
const char *passphrase, struct sshkey **keyp, char **commentp) |
{ |
{ |
int r; |
|
|
|
*keyp = NULL; |
*keyp = NULL; |
if (commentp != NULL) |
if (commentp != NULL) |
*commentp = NULL; |
*commentp = NULL; |
|
|
return sshkey_parse_private2(blob, type, passphrase, |
return sshkey_parse_private2(blob, type, passphrase, |
keyp, commentp); |
keyp, commentp); |
case KEY_UNSPEC: |
case KEY_UNSPEC: |
if ((r = sshkey_parse_private2(blob, type, passphrase, keyp, |
if (sshkey_parse_private2(blob, type, passphrase, keyp, |
commentp)) == 0) |
commentp) == 0) |
return 0; |
return 0; |
#ifdef WITH_OPENSSL |
#ifdef WITH_OPENSSL |
return sshkey_parse_private_pem_fileblob(blob, type, |
return sshkey_parse_private_pem_fileblob(blob, type, |
|
|
|
|
int |
int |
sshkey_parse_private_fileblob(struct sshbuf *buffer, const char *passphrase, |
sshkey_parse_private_fileblob(struct sshbuf *buffer, const char *passphrase, |
const char *filename, struct sshkey **keyp, char **commentp) |
struct sshkey **keyp, char **commentp) |
{ |
{ |
int r; |
|
|
|
if (keyp != NULL) |
if (keyp != NULL) |
*keyp = NULL; |
*keyp = NULL; |
if (commentp != NULL) |
if (commentp != NULL) |
|
|
|
|
#ifdef WITH_SSH1 |
#ifdef WITH_SSH1 |
/* it's a SSH v1 key if the public key part is readable */ |
/* it's a SSH v1 key if the public key part is readable */ |
if ((r = sshkey_parse_public_rsa1_fileblob(buffer, NULL, NULL)) == 0) { |
if (sshkey_parse_public_rsa1_fileblob(buffer, NULL, NULL) == 0) { |
return sshkey_parse_private_fileblob_type(buffer, KEY_RSA1, |
return sshkey_parse_private_fileblob_type(buffer, KEY_RSA1, |
passphrase, keyp, commentp); |
passphrase, keyp, commentp); |
} |
} |
#endif /* WITH_SSH1 */ |
#endif /* WITH_SSH1 */ |
if ((r = sshkey_parse_private_fileblob_type(buffer, KEY_UNSPEC, |
return sshkey_parse_private_fileblob_type(buffer, KEY_UNSPEC, |
passphrase, keyp, commentp)) == 0) |
passphrase, keyp, commentp); |
return 0; |
|
return r; |
|
} |
} |