Basic SSL commands for OpenSSL

Basic SSL commands for OpenSSL 

1. Connect to your server via SSH.
2. To generate CSR via OpenSSL run the following command:
openssl req -out domain.com.csr -new -newkey rsa:2048 -nodes -keyout domain.com.key

3. To generate CSR for existing key:
openssl req -out CSR.csr -key privateKey.key -new

4. To generate CSR for existing SSL:
openssl x509 -x509toreq -in certificate.crt -out CSR.csr -signkey privateKey.key

5. To check if SSL certificate matches with the private key.
SSL certification check:
openssl x509 -noout -modulus -in certificate.crt | openssl md5

Private key check:
openssl rsa -noout -modulus -in privateKey.key | openssl md5

Get information for CSR, SSL and private key.
SSL information: openssl x509 -in certificate.crt -text -noout
CSR info: openssl req -text -noout -verify -in CSR.csr
Private key info: openssl rsa -in privateKey.key -check