title: Is this pdf digital signed correctly? PHP/TCPDF
body: <p>I'm updating a project for my company and there is a section where we need to digitally sign a pdf with our certificate file. In this case, I should change the script that signs this pdf using an updated library from PHP.</p>
  
  <p>In the old code, we were using another script to make happen that, and we had to use a .p12 file + a string. Using this old script, when you open the created pdf with Acrobat Reader DC we get the next image where you can see that says "Signed and all signatures are valid".</p>
  
  <p><a href="https://i.stack.imgur.com/lWnV6.png" rel="noreferrer"><img src="https://i.stack.imgur.com/lWnV6.png" alt="enter image description here"></a></p>
  
  <p>In the new script, I'm using the next example:</p>
  
  <p><a href="https://tcpdf.org/examples/example_052/" rel="noreferrer">https://tcpdf.org/examples/example_052/</a></p>
  
  <p>To be able to apply this example with my certificate I had to convert my pfx file certificate (".p12") to 2 kinds of ".pem" throw these nexts commands lines:</p>
  
  <p>openssl pkcs12 -in myOldCertificate.p12 -clcerts -nokeys -out publicCert.pem -> asked me "Enter Import Password"</p>
  
  <p>openssl pkcs12 -in myOldCertificate.p12 -nocerts -out privateKey_cert.pem -> asked me "Enter Import Password" and also for "Enter PEM pass phrase"</p>
  
  <p>So finally, I just changed the line 89 from the downloaded example 52.</p>
  
  <p>// set document signature</p>
  
  <p>$pdf->setSignature('file:///var/www/html/publicCert.pem', 'file:///var/www/html/privateKey_cert.pem', 'xxxxxx', '', 2, $info); -> In the 'xxxxx' I wrote the same string as the Import password and, just in case, also the same for PEM pass phrase.</p>
  
  <p>And when I create the digital signed pdf and open it with the Acrobat Reader DC you can see the next image:</p>
  
  <p><a href="https://i.stack.imgur.com/d59XN.png" rel="noreferrer"><img src="https://i.stack.imgur.com/d59XN.png" alt="enter image description here"></a></p>
  
  <p>My worry is because I can see that says "Certified by My company certification" and seems all ok but there is not green tick and I'm not sure if it's completely valid. You have to think that I will need the most secure way to verify the authenticity and the integrity of this pdf.</p>