View Full Version : SSH (private) key generation

03-20-2009, 01:30 PM

I started a new topic as the search delivered nothing.

Does anybody know of an easy way to dynamically generate an RSA SSH private key using PHP?

The only solution I have so far is to call/execute the script 'ssh-keygen.exe' with the correct parameters, load the generated key from file and delete the file afterwards. (Unfortunately) this will work on our Apache server (using Debian Linux) but not under my development environment where I use XAMPP on a Windows machine.

I have seen there is a Chilkat.Sshkey class available, but apparently one must by the activex component that actually generates the keys. And from what I can see, it is only windows based. :(

Any other classes/packages available for this? Or is there a way to get ssh-keygen to return the generated key in a variable instead of saving it to file?

The background:
I want to dynamically generate a private SSH Key when a user registers for our service. This key can be downloaded (.zip via sftp) by the user.

Any helpful info would be greatly appreciated! :D