openssl

Create Certificate Authority (CA):

openssl genrsa -aes256 -out ca-key.pem 4096

Create Root Certificate:

openssl req -x509 -new -nodes -extensions v3_ca -key ca-key.pem -days 10024
-out ca-root.pem -sha512

Generate signed public key:

openssl x509 -req -in certificate.csr -CA ca-root.pem -CAkey ca-key.pem
-CAcreateserial -out certificate-pub.pem -days 365 -sha512

Generate a RSA private key:

openssl genrsa -out private.pem 4096

Create CSR:

openssl req -new -sha256 -key private.pem -out csr.pem

Or in one command:

openssl req -nodes -new -newkey rsa:4096 -out csr.pem

Convert a DER file (.crt .cer .der) to PEM

openssl x509 -inform der -in certificate.cer -out certificate.pem

Self-signed certificate in one command

openssl req -x509 -newkey rsa:2048 -keyout key.pem -out cert.pem -days 9999
-nodes