openssl command in php
问题 I want to generate example.com.crt and example.com.pem using php. The Linux command to get the files is given: openssl req -newkey rsa:2048 -new -x509 -days 3652 -nodes -out example.com.crt -keyout example.com.pem I want to get the two file contents in two string in php. What is the php equivalent code for this? UPDATE: Please don't ask to execute the Linux command. 回答1: You could use phpseclib, a pure PHP X.509 implementation: http://phpseclib.sourceforge.net/x509/examples.html#selfsigned <