OpenSSL Cheat-sheet

OpenSSL Cheat-sheet

Generate random bytes

openssl rand -base64 512
openssl rand -hex 512
openssl rand -base64 -out myFile.key 512

Check the format of the private key

openssl rsa -check -in private_key.pem

Generate RSA key pair

openssl genrsa -out private_key_2048.pem 2048
openssl rsa -in private_key_2048.pem -outform PEM -pubout -out public_key_2048.pem