Skip to content

Commit

Permalink
Merge pull request #4298 from LibreSign/backport/4296/stable29
Browse files Browse the repository at this point in the history
[stable29] chore: display signature issue when haven't proppler
  • Loading branch information
vitormattos authored Jan 13, 2025
2 parents 3257084 + 9d7f7da commit c2d3c32
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 7 deletions.
1 change: 1 addition & 0 deletions lib/Handler/Pkcs12Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ public function getCertificateChain($resource): array {
$certificates[$signerCounter] = $fromFallback;
}
if (!$signature) {
$certificates[$signerCounter]['chain'][0]['signature_validation'] = $this->getReadableSigState('Digest Mismatch.');
$signerCounter++;
continue;
}
Expand Down
22 changes: 16 additions & 6 deletions lib/Service/FileService.php
Original file line number Diff line number Diff line change
Expand Up @@ -424,24 +424,34 @@ 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]['subject']['CN'])) {
$this->fileData->signers[$index]['displayName'] = $signer['chain'][0]['subject']['CN'];
}
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('/^(?<key>.*):(?<value>.*), /', $signer['chain'][0]['subject']['CN'], $matches)) {
$signatureToShow['uid'] = $matches['key'] . ':' . $matches['value'];
} elseif (!empty($signer['chain'][0]['subject']['CN'])) {
if (preg_match('/^(?<key>.*):(?<value>.*), /', $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'][] = [
Expand Down
2 changes: 1 addition & 1 deletion src/views/Validation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ export default {
return signer.email
}
return 'None'
return signer.signature_validation.label
},
getIconValidityPath(signer) {
if (signer.is_valid) {
Expand Down

0 comments on commit c2d3c32

Please sign in to comment.