Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error ValidatePdfSignature #27

Closed
edwinmacalopu opened this issue Dec 23, 2021 · 4 comments · Fixed by #28
Closed

error ValidatePdfSignature #27

edwinmacalopu opened this issue Dec 23, 2021 · 4 comments · Fixed by #28
Assignees
Labels
bug Something isn't working documentation Improvements or additions to documentation help wanted Extra attention is needed

Comments

@edwinmacalopu
Copy link

an error occurs when validating a signature, apparently the format for other countries is different, it is a certificate from Peru

try {
           dd(ValidatePdfSignature::from('.../sign.pdf'));
        } catch (\Throwable $th) {
           return $th;
        }

adobe acrobat
image

use ValidatePdfSignature()

image

@lsnepomuceno lsnepomuceno self-assigned this Dec 23, 2021
@lsnepomuceno lsnepomuceno added bug Something isn't working documentation Improvements or additions to documentation help wanted Extra attention is needed labels Dec 23, 2021
@lsnepomuceno
Copy link
Owner

Hi @edwinmacalopu,

Would you have a signed example pdf file?

That way I can validate the structure.

@edwinmacalopu
Copy link
Author

@lsnepomuceno yes I attached signed PDF .
sign.pdf

@edwinmacalopu
Copy link
Author

@lsnepomuceno find the error is a field that when separating with explode does not have key 1 value in the signature, in my case I put a validator if there is key 1 add it to the array
image

private function processDataToInfo(string $data): array
  {
    $data = explode('/', trim($data));
    $finalData = [];
    foreach ($data as $info) {
      $infoTemp = explode('=', trim($info));
        if (isset($infoTemp[1])) {
        $finalData[] = [$infoTemp[0] => $infoTemp[1]];
       }
      }
    return $finalData;
  }

image

@lsnepomuceno lsnepomuceno linked a pull request Dec 23, 2021 that will close this issue
@lsnepomuceno
Copy link
Owner

@edwinmacalopu

Although I haven't identified the problem with validating array indexes (as shown in the screenshots below), I've updated the method to avoid potential issues.

Available in version 0.0.14.

Thank you for your contribution.

validate-2
validate-1

Repository owner locked as resolved and limited conversation to collaborators Dec 23, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working documentation Improvements or additions to documentation help wanted Extra attention is needed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants