Certificate for TCPDF

大兔子大兔子 提交于 2019-12-04 01:50:00
lubosdz

The approach is basically correct - but you may have missed some detail in it.

I have been using the certificate in *.crt format without the passphrase (including private and public key) and it works fine.

Also note, that you must have installed OpenSSL extension in PHP.

See the comments for method TCPDF::setSignature() by Nicola Asuni:

* To create self-signed signature: openssl req -x509 -nodes -days 365 -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

You dont need to install any certificate into Acrobat Reader - generated PDF documents signed with self-signed certificates simply show up as untrusted, but still they can normally open.

I hope you also took a look at the comments ;) there is a mini how to setup the pdf using provided file

especially:

// To open the document you need to install the private key (tcpdf.p12) on the Acrobat Reader. The password is: 1234

however, you need to provide setProtection with existing key:

'c' => 'file://../tcpdf.crt'

the path you given is just showing where you need to give the path, but the path itself need to be changed

Summary: please read again the comments in the example 016 file, they WILL help to get it working the way you need

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!