Sign documents with digital certificate using php or js

Asked

Viewed 7,122 times

1

I need to develop a code (JS or PHP) in which after uploading a PDF file it is automatically signed by a digital certificate model A1 that is already allocated on the server.

  • 3

    Reading the question does not understand what you need to know. Please give more details of the problem and state what exactly you do not know how to do yourself, or the question will be considered too broad for the site. The problem is how to digitally sign the file after uploading?

  • I need to know if there is a code (php or js) in which when uploading a document (.PDF) to the site server , it will be automatically signed by a digital certificate

  • there is a code that digitally sign the pdf while uploading?

  • 1

    While uploading the file is not complete on the server. You need to receive the whole file first, and then sign via PHP (or another tool) on the server itself. I guess I don’t know how to do, but other users may know, let’s wait.

  • That’s my question! Maybe you have some tool responsible for signing. So far, I know you have to have a Model A1 Digital Certificate inside the server. Thank you for your attention

  • 1

    I don’t have an answer, but let’s split up: 1) A1 certificate format is PKCS#12; 2) That question on the Soen shows a way to sign Pdfs using PHP, Zend, and Openssl, might suit your case; 3) If your server has access to Java, there is a tool - Portablesigner - that makes the work much easier; more details in that post (in English).

Show 1 more comment

1 answer

2

The library TCPDF can be used to add the certificate to the PDF.

On their website there is a complete example creation and signature, but since you need to sign an existing PDF I suggest you take a look at the class TCPDF_IMPORT (methods setSignature and setSignatureAppearance) to import the document and set the certificate.

An alternative that is not free is the Setapdf-Signer. I’ve never tested this but it seems to be even simpler to use than TCPDF.

  • Very good, but a detail, it’s written Certification Signature (experimental), then the use is by use account (without wanting to put fear), although the date is 2013 of the last update, maybe today is already stable.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.