Quickly create openssl cert and key

Here’s a one-liner for generating a self-signed certificate. This is primarily for me to quickly find when I cannot remember the openssl command line.

Requirements / info

  • requires openssl
  • key length is 2048
  • cert validity is 365 days
1
openssl req -new -newkey rsa:2048 -days 365 -nodes -x509 -keyout server.key -out server.crt

Updated: