PHP code example of lufox11 / pdf-sign-validator

1. Go to this page and download the library: Download lufox11/pdf-sign-validator library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

lufox11 / pdf-sign-validator example snippets


use LufoX11\PdfSignValidator\PdfSignValidator;

/**
 * signed.pdf: Path to the signed PDF file.
 * issuer.cer: Path to the public key file (RSA PUBLIC KEY) of the issuer.
 * subject.cer: Path to the public key file (RSA PUBLIC KEY) of the subject.
 */

$amountOfSignatures = PdfSignValidator::signCount('signed.pdf');
$certificateIsValid = PdfSignValidator::certIsValid('subject.cer', 'issuer.cer');
$certificateData = PdfSignValidator::infoFromPEM('certificate.cer');
$certificateData = PdfSignValidator::infoFromPDF('signed.pdf');

// Single signature in PDF file
$signatureIsValid = PdfSignValidator::signIsValid('signed.pdf', 'issuer.cer');
$certificateMatchSubject = PdfSignValidator::signMatchSubject('signed.pdf', 'subject.cer');

// Multiple signatures in PDF file
// You can specify the signature to work with in dot notation
$signatureIsValid = PdfSignValidator::signIsValid('signed.pdf', 'issuer.cer', [ 'subject.common_name' => 'Lionel Messi' ]);
$certificateMatchSubject = PdfSignValidator::signMatchSubject('signed.pdf', 'subject.cer', [ 'issuer.common_name' => 'Magnus Carlsen' ]);