Need to create RSA key with forced exponent 35 and using ssh-keygen


I have a rather unusual problem. I will spare you the details, but on one CentOS 7 server I need to create a new RSA key. We would normally use this command:

ssh-keygen -h -f /etc/ssh/ssh_host_rsa_key

However, this command creates the key with Public Exponent 65537 (0x10001). But for compatibility reasons with one application I need the key to be created with Public Exponent 35 (0x23), just as was the default with CentOS 5 and CentOS 6.

Any help would be appreciated.

Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I see rhel5 and rhel6 using 65537 by default.
You can read on how 65537 became default 8 years ago, right before RHEL5 was released.

If you really insist on generating weak keys you can use openssl genrsa which supports them.
tomfraAuthor Commented:
Well, on CentOS 6, even updated to the latest version, the following command:

ssh-keygen -h -f /etc/ssh/ssh_host_rsa_key

generates the key with exponent 35 (0x23). I need to know the exact command to replicate this behavior on CentOS 7 before one application we use is updated and distributed to all users.
Horrible... They keep old vulnerability alive.

As I said - openssl genrsa generates exactly same keys
Write "openssl genrsa --help" to learn more
If you cannot find parameter you can generate key on old systems. Dont forget to use /dev/zero as RNG for full security effect in this case.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
tomfraAuthor Commented:
Thanks for the information, accepting your solution.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Linux Security

From novice to tech pro — start learning today.