Background
With openssl version 1.1.1n, I used to use
openssl genrsa -out myFile.pem
and my key file would look like this:
-----BEGIN RSA PRIVATE KEY-----
...
-----END RSA PRIVATE KEY-----
Problem
However, I recently updated to Ubuntu 22.04 and now I have openssl version 3.0.2. Now when I run that command, the output file looks like this:
-----BEGIN PRIVATE KEY-----
...
-----END PRIVATE KEY-----
Notice that the "RSA
" is missing. My application now says "unsupported key format" because of this.
What I Tried
I tried using
openssl genpkey -algorithm RSA -out myFile.pem
because the docs for genrsa
say it's deprecated and recommend using genpkey
instead. But this gave the same results (the file is missing the "RSA
" part).
Question
How can I properly generate an RSA key using openssl that matches the old format?