I'm using openSSL
to create RSA
public and private key
. I create success, and output is 2 keys with format private_key.pem
and public_key.pem
.
So, the requirement is public key need to be in .cer
extension
, Base 64 format
and start with header: -----BEGIN
I do some researches but can't find to to convert pem
to cer
Any ideas? Thanks.
P/S: Here is script that I used to generate key:
openssl genrsa -out private_key.pem 2048
openssl rsa -in private_key.pem -outform PEM -pubout -out public_key.pem
Update
Finally, I found solution for this, just for those who need it.
set OPENSSL_CONF=C:\Program Files (x86)\GnuWin32\share\openssl.cnf
openssl genrsa -out private_key.pem 2048 -sha256 -passout pass:abc123
openssl req -new -x509 -sha256 -key private_key.pem -out public_key.cer -days 3650