Converting a private.pem private key to an private.key RSA private key

On some hosting environments, you are asked to provide an RSA private key, usually in the private.key format.

PHP does not offer an easy way to generate this, but on the command line this can be done very simply.

Open the terminal on your computer, then type the following (private.pem should be the path to the actual file):

openssl rsa -in private.pem -out private.key

The new private.key will will now be generated.

Simple and Performant Security.
Easily improve site security with WordPress Hardening, Two-Factor Authentication (2FA), Login Protection, Vulnerability Detection and SSL certificate generation.