Skip to content

Commit

Permalink
check the certificate (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
erikn69 authored Jun 2, 2023
1 parent 9710a24 commit fa184b5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/PDFDoc.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,8 @@ public function set_signature_certificate($certfile, $certpass = null) {
// If a password is provided, we'll try to decode the private key
if (openssl_pkey_get_private($certificate["pkey"]) === false)
return p_error("invalid private key");

// TODO: check the certificate
if (! openssl_x509_check_private_key($certificate["cert"], $certificate["pkey"]))
return p_error("private key doesn't corresponds to certificate");
} else {
$certfilecontent = file_get_contents($certfile);
if ($certfilecontent === false)
Expand Down

0 comments on commit fa184b5

Please sign in to comment.