Quick and dirty:

openssl req -new -days XXX -newkey rsa:4096bits -sha512 -x509 -nodes -out SERVER.crt -keyout SERVER.key