Windows – Openssl: Generate CSR for private key read from stdin

opensslwindows

I am tring to get openssl to generate a CSR for an existing private key using the windows binary of OpenSSL.

Normally the command line for this would be:

openssl.exe req -new -sha256 -out test.csr -key privkey.pem

However for security reasons I'd like to provide the key via standard input so I don't need to store the private key file on disk.

There was a similar question with a solution specific to Linux, however I am using Windows so that cannot be applied.

Best Answer

Unlike the Linux build the Windows build of openssl supports - to tell the application to read from stdin.

openssl.exe req -new -sha256 -out test.csr -key -

Another option would be to use a RAM drive to store the key file temporarily.