php signature error is because the signature container embedded in the document exceeds the size originally reserved for it. The solution is to reserve more space for the signature container.
The operating environment of this article: Windows 7 system, PHP version 7.1, DELL G3 computer
How to solve the problem of php signature error?
Problem description:
I am using TCPDF to generate a pdf document and sign it. TCPDF itself just calls PHP's openssl_pkcs7_sign function, which I see Comes based on source code.
Everything was working fine until recently. Then I changed the certificate provider. I just updated the private key, certificate and certificate chain:
$pdf->setSignature( $this->public_certificate_path, $this->private_key_path, $this->private_key_password, $this->extra_certificates_path, 1);
I added the following in the extra_certificates_path file with Copied the new root and intermediate certificates in PEM format. I verified the file using openssl and it looks fine.
Now when I open the signed PDF in Adobe Reader it shows the following error :
打开文件时,它说<块引用> 此文件已损坏但正在修复中 上面的蓝丝带说<块引用> 认证无效 当我打开签名面板时,它显示<块引用> 由 %s 认证 错误详情说<块引用> 此签名中包含的格式或信息有错误(支持信息:SigDict/Contents 非法数据) 当我点击"证书详细信息"时,没有任何反应?
Solution:
Analysis of the sample file shared by the OP can understand the problem: the signature container embedded in the document exceeds the size originally reserved for it.
Therefore, the solution is to reserve more space for the signature container.
Recommended learning: "PHP Video Tutorial"
The above is the detailed content of How to solve php signature error problem. For more information, please follow other related articles on the PHP Chinese website!