Trust: add serialNumber and issuer in Store::parseX509(), requested in https://github.com/opnsense/core/issues/8141#issuecomment-2571771937

Since we map subjects, we should do the same when adding an issuer if it exists. serialNumber is just a plain simple field.
This commit is contained in:
Ad Schellevis 2025-01-06 09:44:57 +01:00
parent e150a571de
commit f72e066e4d

View File

@ -418,11 +418,19 @@ class Store
// valid from/to and name of this cert
$result['valid_from'] = $crt['validFrom_time_t'];
$result['valid_to'] = $crt['validTo_time_t'];
$result['name'] = $crt['name'];
foreach (['name', 'serialNumber'] as $cpy) {
$result[$cpy] = $crt[$cpy] ?? null;
}
foreach (self::$issuer_map as $key => $target) {
if (!empty($crt['subject'][$key])) {
$result[$target] = $crt['subject'][$key];
}
if (!empty($crt['issuer']) && !empty($crt['issuer'][$key])) {
if (empty($result['issuer'])) {
$result['issuer'] = [];
}
$result['issuer'][$target] = $crt['issuer'][$key];
}
}
// OCSP URI
if (!empty($crt['extensions']) && !empty($crt['extensions']['authorityInfoAccess'])) {