Generate RSA private key, 4096 bit
openssl genrsa 4096
Generate RSA private key, 2048 bit with password
openssl genrsa -aes256
Save the generated RSA private key
openssl genrsa -aes256 -out private.pem
Generate and save public key from private key
openssl rsa -in private.pem -outform PEM -pubout -out public.pem
RSA 2048 bit key
# Generate Certifcate Request
openssl req -new -newkey rsa:2048 -nodes -keyout shubhamtatvamasi.key -out shubhamtatvamasi.csr
# Self-Sign Certificate
openssl x509 -req -in shubhamtatvamasi.csr -signkey shubhamtatvamasi.key -out shubhamtatvamasi.crt -days 365
Get the list of curves available
openssl ecparam -list_curves
Only
secp384r1
andprime256v1
keys are compatible with modern browsers
Generate new private key
openssl ecparam -name secp384r1 -genkey -out ec_key.pem
Generate certificate
openssl req -new -key ec_key.pem -x509 -nodes -days 3650 -out cert.pem
Generate Diffie-Hellman key exchange
openssl dhparam -out dhparam.pem 4096
add
-dsaparam
flag for faster key generation
ecdhp256 vs ecdhp384, operations per second
openssl speed ecdhp256 ecdhp384
openssl x509 -text -noout -in certificate.crt
awk 'NF {sub(/\r/, ""); printf "%s\\n",$0;}' cert-name.pem