If need to download the openssl from the link: https://code.google.com/archive/p/openssl-for-windows/downloads. Download .zip file and extract into the any location. Go to that location till in my case its C:\openssl-0.9.8k_X64\bin
.
As per link : https://rietta.com/blog/2012/01/27/openssl-generating-rsa-key-from-command/, you need to execute the following command:
You can generate a public and private RSA key pair like this:
openssl genrsa -des3 -out private.pem 2048
That generates a 2048-bit RSA key pair, encrypts them with a password you provide, and writes them to a file. You need to next extract the public key file. You will use this, for instance, on your web server to encrypt content so that it can only be read with the private key.
As per link: https://www.openssl.org/docs/manmaster/apps/pkcs8.html and https://superuser.com/questions/606215/openssl-pkcs8-default-format-gives-rsa-private-key
Read a DER unencrypted PKCS#8 format private key:
openssl pkcs8 -topk8 -inform pem -in file.key -outform pem -nocrypt -out file.pem
and create the public key like below
openssl rsa -in key.pem -pubout -out pubkey.pem
Done !!