diff --git a/lib/Handler/Pkcs12Handler.php b/lib/Handler/Pkcs12Handler.php index 0c8a7eb26a..b9bcee6357 100644 --- a/lib/Handler/Pkcs12Handler.php +++ b/lib/Handler/Pkcs12Handler.php @@ -140,6 +140,7 @@ public function getCertificateChain($resource): array { $certificates[$signerCounter] = $fromFallback; } if (!$signature) { + $certificates[$signerCounter]['chain'][0]['signature_validation'] = $this->getReadableSigState('Digest Mismatch.'); $signerCounter++; continue; } diff --git a/lib/Service/FileService.php b/lib/Service/FileService.php index 2d3c79d6e1..1ac205ff95 100644 --- a/lib/Service/FileService.php +++ b/lib/Service/FileService.php @@ -408,24 +408,32 @@ private function loadLibreSignSigners(): void { private function loadSignersFromCertData(): void { $this->loadCertDataFromLibreSignFile(); foreach ($this->certData as $index => $signer) { - $this->fileData->signers[$index]['subject'] = $signer['chain'][0]['name']; - $this->fileData->signers[$index]['displayName'] = $signer['chain'][0]['subject']['CN']; + if (!empty($signer['chain'][0]['name'])) { + $this->fileData->signers[$index]['subject'] = $signer['chain'][0]['name']; + } if (!empty($signer['chain'][0]['validFrom_time_t'])) { $this->fileData->signers[$index]['valid_from'] = $signer['chain'][0]['validFrom_time_t']; } if (!empty($signer['chain'][0]['validTo_time_t'])) { $this->fileData->signers[$index]['valid_to'] = $signer['chain'][0]['validTo_time_t']; } - $this->fileData->signers[$index]['signed'] = $signer['signingTime']->format('Y-m-d H:i:s'); + if (!empty($signer['signingTime'])) { + $this->fileData->signers[$index]['signed'] = $signer['signingTime']->format('Y-m-d H:i:s'); + } $this->fileData->signers[$index]['signature_validation'] = $signer['chain'][0]['signature_validation']; if (!empty($signer['chain'][0]['certificate_validation'])) { $this->fileData->signers[$index]['certificate_validation'] = $signer['chain'][0]['certificate_validation']; } - $this->fileData->signers[$index]['hash_algorithm'] = $signer['chain'][0]['signatureTypeSN']; + if (!empty($signer['chain'][0]['signatureTypeSN'])) { + $this->fileData->signers[$index]['hash_algorithm'] = $signer['chain'][0]['signatureTypeSN']; + } if (!empty($signer['chain'][0]['subject']['UID'])) { $this->fileData->signers[$index]['uid'] = $signer['chain'][0]['subject']['UID']; - } elseif (preg_match('/^(?.*):(?.*), /', $signer['chain'][0]['subject']['CN'], $matches)) { - $signatureToShow['uid'] = $matches['key'] . ':' . $matches['value']; + } elseif (!empty($signer['chain'][0]['subject']['CN'])) { + $this->fileData->signers[$index]['displayName'] = $signer['chain'][0]['subject']['CN']; + if (preg_match('/^(?.*):(?.*), /', $signer['chain'][0]['subject']['CN'], $matches)) { + $signatureToShow['uid'] = $matches['key'] . ':' . $matches['value']; + } } for ($i = 1; $i < count($signer['chain']); $i++) { $this->fileData->signers[$index]['chain'][] = [ diff --git a/src/views/Validation.vue b/src/views/Validation.vue index ef329697ca..07c2089dbd 100644 --- a/src/views/Validation.vue +++ b/src/views/Validation.vue @@ -522,7 +522,7 @@ export default { return signer.email } - return 'None' + return signer.signature_validation.label }, getIconValidityPath(signer) { if (signer.is_valid) {