I'm actually working in a small project for myself, is a Web Application that creates Certificate Signing Request also the certificate .pem/.crt
and its .key
.
The actual problem is that I'm trying to run:
shell_exec(openssl ca -config ../openssl.cnf -in $CSR_FILE -out $CRT_FILE)
And I find the problem that after running this command is asking for my CA passphrase, and later on answering Yes twice to accept the creation of the certificate. I can't figure it out how to make it work. I've been stuck with that for almost three days, neither Google or Stack Overflow has an anwser.
I've tried to run the command and add another shell_exec(passphrase)
also, passing passphrase and "y" twice this way.
shell_exec("openssl....","passphrase","y","y")
Thank you very much, i appreciate all help.
You don't have to use
shell_exec()
for this. You can create slef signed certificate by using openssl_csr_new() PHP function.It generates a new CSR (Certificate Signing Request) based on the information provided by dn, which represents the Distinguished Name to be used in the certificate.
PHP Code to generate self-signed-certificate