开发者

Warning: openssl_pkcs7_sign() [function.openssl-pkcs7-sign]: error getting private key in C:\xampp\htdocs\this\tcpdf\tcpdf.php on line 8366

开发者 https://www.devze.com 2023-03-28 23:37 出处:网络
I am using TCPDF to sign PDF, but when running the example 52 I got this error: Warning: openssl_pkcs7_sign() [function.openssl-pkcs7-sign]: error getting

I am using TCPDF to sign PDF, but when running the example 52 I got this error:

Warning: openssl_pkcs7_sign() [function.openssl-pkcs7-sign]: error getting 
private key in C:\xampp\ht开发者_StackOverflow中文版docs\this\tcpdf\tcpdf.php on line 8366

Could you please tell me or guide me where is the problem. I am just running the example without changing anything. I am using xampp.


The problem is with the location from where it tries to access the private key. Instead of '' like in their example use 'file://'.( dirname(FILE)).'./path/to/file'. This worked for me.


I solved it by using:

$certificate = 'file://'.realpath('../tcpdf.crt');

When you create your own certificate use this:

/*
NOTES:
 - To create self-signed signature: openssl req -x509 -nodes -days 365000 -newkey rsa:1024 -keyout tcpdf.crt -out tcpdf.crt
 - To export crt to p12: openssl pkcs12 -export -in tcpdf.crt -out tcpdf.p12
 - To convert pfx certificate to pem: openssl pkcs12 -in tcpdf.pfx -out tcpdf.crt -nodes
*/


Finally, after weeks ago, I found the solution. I just donwloaded the TCPDF 5.9 Version and it works :D if you wanna try, here's the link to download that version

link: https://sourceforge.net/code-snapshots/git/u/u/u/mynetx/tcpdf.git/u-mynetx-tcpdf-5828c0d80580cbad069988e2067ad5e37e1e98e7.zip

0

精彩评论

暂无评论...
验证码 换一张
取 消