Create a self signed certificate with OpenSSL and export to PFX

I’ve needed to create a self signed certificate on a few occasions and had to google-fu the commands each time. Here’s some commands for creating your certificate

# Generate private key
openssl genrsa 2048 > private.pem

# Create certificate request with 1 year expiry
openssl req -x509 -days 365 -new -key private.pem -out public.pem

# Create PFX from public and private key
openssl pkcs12 -export -in public.pem -inkey private.pem -out certificate.pfx