Forum


Replies: 1   Views: 1174
Multiple signatures for a document
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by Thierry DUPONT  · 22-10-2021 - 11:24

Hi all,

Do you what the process for digitally sign for multiple users?
Can we add signature for a document and after another in a second time?

How to proceed if we have to put the name / first name in an insert in the file?
The first signature will no longer be valid when we add the second because the document will be modified.

Or the solution is?
- we have a document A.
- first signing. We save the sign doc (doc1).
- second signing. We save the sign doc (doc2).
- and after signing document A with two signs. We have also a new document (doc3).
Doc1 & doc2 allow to keep a trace that the original document has not been modified except for the addition of the surnames / first names in the document.

Is it the right approach?

Thank you for your help. 

Posted by admin  · 22-10-2021 - 11:39

Hello,

All documents (DOCX, PDF, XLSX, PPTX) can be signed using more than one signature using signature methods included in Premium licenses (https://www.phpdocx.com/documentation/introduction/digital-signature-docx-pdf-PHP).

For example, you can sign a DOCX:

$sign = new SignDOCX();
$sign->setDocx('Text.docx');
$sign->setPrivateKey('key_1.pem', 'phpdocx');
$sign->setX509Certificate('cert_1.pem');
$sign->setSignatureComments('This document has been signed.');
$sign->sign();

If you change the signed DOCX using phpdocx or any other tool, MS Word and other DOCX readers will display a message that the document has changed and the signature is not valid.

The same DOCX can be signed again adding a new signature (the same or other signature):

$sign = new SignDOCX();
$sign->setDocx('Text.docx');
$sign->setPrivateKey('key_2.pem', 'otherpassword');
$sign->setX509Certificate('cert_2.pem');
$sign->setSignatureComments('This document has been signed.');
$sign->sign();

and you'll get a DOCX with two signatures (or more if needed).

Since phpdocx 12, the Indexer class (https://www.phpdocx.com/api-documentation/docxutilities/indexer-parse-word-documents-with-PHP) allows extracing signatures information from a DOCX.

Regards.