catch the case if a p12 file does only contain a key

This commit is contained in:
HB9HIL
2024-08-19 16:37:27 +02:00
parent ee7127a599
commit 36cb64b3e2

View File

@@ -405,7 +405,14 @@ class Lotw extends CI_Controller {
$filename = file_get_contents('file://'.$file);
$worked = openssl_pkcs12_read($filename, $results, $password);
$data['general_cert'] = $results['cert'];
if ($results['cert']) {
$data['general_cert'] = $results['cert'];
} else {
log_message('error', 'Found no cert in '.$file);
unlink($file);
$this->session->set_flashdata('warning', sprintf(__("Found no cert in %s. If the filename contains 'key-only', this p12 file is not activated by LoTW yet."), $file));
redirect('lotw');
}
if($worked) {