Painless self-signed certificates

How to quickly create a self-signed TLS certificates and convert it to common formats.

Whenever I needed a quick self-signed TLS certificate, it took me ages to get the command line parameters to openssl right.

This code snippet creates a key and certificate for localhost that is valid for approx. 1 year in PEM format. It also and creates a PKCS 12 store and a Java Keystore containing the same certificate and private key for easier re-use in applications requiring these formats.

[Read More]