Skip to content

Commit

Permalink
chore: display signature issue when haven't proppler
Browse files Browse the repository at this point in the history
Signed-off-by: Vitor Mattos <[email protected]>
  • Loading branch information
vitormattos committed Jan 13, 2025
1 parent 9f2cbfd commit f1921aa
Show file tree
Hide file tree
Showing 3 changed files with 16 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 @@ -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;
}
Expand Down
20 changes: 14 additions & 6 deletions lib/Service/FileService.php
Original file line number Diff line number Diff line change
Expand Up @@ -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('/^(?<key>.*):(?<value>.*), /', $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('/^(?<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 @@ -522,7 +522,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 f1921aa

Please sign in to comment.