Creating your own self-signed certificates and keys (UPDATED)

I’ve set up a little PHP page that will generate self-signed certificates and bundle the associated private key in a PKCS12 file:

Basically it uses OpenSSL like this:

openssl genrsa -aes256 2048 > temp.key
openssl req -new -x509 -key temp.key -out temp.crt -days 365 -subj "/CN=John\ Doe/"
openssl pkcs12 -export -in temp.crt -out temp.p12 -name "my self signed P12 from" -inkey temp.key

It’s a handy little utility; a quick and dirty way to generate certificates for testing. I’m sure that I will be broaden the features soon.

Originally wrote some bash scripts that used the “openssl” command on the server, but it was kinda hokey with a bit too much file IO.

Now, the backend has been rewritten to use the (sparsely documented) OpenSSL functions in PHP.

Leave a Reply