Alexis.Rolland
Alexis.Rolland

Reputation: 6363

Generate cert.pem and key.pem on Windows

I need to generate a cert.pem and key.pem files to encrypt http requests with Nginx.

On Linux, I would execute the following OpenSSL command:

openssl req -x509 -newkey rsa:4096 -nodes \
          -out ./nginx/config/cert.pem \
          -keyout ./nginx/config/key.pem -days 365

What would be an equivalent command to generate such files on Windows? I have followed this guide but it only generates a .crt and .key files instead.

https://helpcenter.gsx.com/hc/en-us/articles/115015960428-How-to-Generate-a-Self-Signed-Certificate-and-Private-Key-using-OpenSSL

Upvotes: 12

Views: 32987

Answers (1)

Alexis.Rolland
Alexis.Rolland

Reputation: 6363

Collecting answers from the comments above:

If you install openssl onto windows then it's the same command.

Or

Rename privateKey.key to key.pem and certificate.crt to cert.pem. It should work just fine

Or

I have also created an OpenSSL Docker container which allows to generate certificates without needing to install OpenSSL on Windows or Linux (assuming you have Docker already installed): https://github.com/alexisrolland/docker-openssl

Upvotes: 6

Related Questions