Link to home
Start Free TrialLog in
Avatar of tomfra
tomfraFlag for Czechia

asked on

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

Hello,

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.

Thanks!
Avatar of gheist
gheist
Flag of Belgium image

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.
https://en.wikipedia.org/wiki/RSA_%28cryptosystem%29#Faulty_key_generation

If you really insist on generating weak keys you can use openssl genrsa which supports them.
Avatar of tomfra

ASKER

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.
ASKER CERTIFIED SOLUTION
Avatar of gheist
gheist
Flag of Belgium image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of tomfra

ASKER

Thanks for the information, accepting your solution.