mirror of
https://git.libssh.org/projects/libssh.git
synced 2026-02-09 09:54:25 +09:00
pki: Make sure imported certificate is certificate
Signed-off-by: Jakub Jelen <jjelen@redhat.com> Reviewed-by: Sahana Prasad <sahana@redhat.com>
This commit is contained in:
committed by
Sahana Prasad
parent
de8f36c93c
commit
a8c844c9c2
13
src/pki.c
13
src/pki.c
@@ -1868,7 +1868,18 @@ int ssh_pki_import_cert_blob(const ssh_string cert_blob,
|
|||||||
*/
|
*/
|
||||||
int ssh_pki_import_cert_file(const char *filename, ssh_key *pkey)
|
int ssh_pki_import_cert_file(const char *filename, ssh_key *pkey)
|
||||||
{
|
{
|
||||||
return ssh_pki_import_pubkey_file(filename, pkey);
|
int rc;
|
||||||
|
|
||||||
|
rc = ssh_pki_import_pubkey_file(filename, pkey);
|
||||||
|
if (rc == SSH_OK) {
|
||||||
|
/* check the key is a cert type. */
|
||||||
|
if (!is_cert_type((*pkey)->type)) {
|
||||||
|
SSH_KEY_FREE(*pkey);
|
||||||
|
return SSH_ERROR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user