Advertisement

03.13.2008 at 03:19AM PDT, ID: 23237929
[x]
Attachment Details

Generating PuTTY SshHostkeys (hashed) from a hostkey

Asked by psyki_be in SSH / Telnet Software, Algorithms

Tags: PuTTY, Putty/Plink, C#

So.
We have OpenSSH on our servers.
In an application I wrote, we make a connection to that server using Plink in a batch.

However, at first connect, it will ask us if you want to accept the Server Host key.
This is the base security model, to prevent man-in-the-middle attacks.

However, my application is running this, in a batch script, and it's impossible to answer that question, which causes my application to hang.

I can circumvent this by connecting to putty first manually and accepting the key.
This creates a Registry key in HKEY_CURRENT_USER\SoftWare\SimonTatham\PuTTY\SshHostKeys

for example:
key name: rsa2@22:192.168.2.168
value:
0x23,0xb4f03e7341bd5890474d34ac607719fb8af5856f9d005d3fd027cb8a247e5b3b451db126b6bb5d2184182bef5fc3a3bb4d9e76d9e41184500f5535830ddd21e7dcbab0a7db9dc557ca0ea73e8e046bff8ab56af87c70b019cdab4947f4c941667096d965c9347cf55882a5df929af93ad2e7ba0dcb8b682f0d5d1b1f7c495aa3d9834f48a2829372c93213592eed3410734b5aa9f4ad895cab599e1010d48fc966b3ee908141b1b621f0720882ec8259a187cab492135fe9f658298f8c356943ade8c0889456010a2b2e9a80bb0583baa60c99ea3465304bf7c99e6c5787a1bbf487e76806c0e414439f577caa1607e002a1330ed111c75c0e6fbc2c8be0d0ad

This is what I know do in the script.
I set the registry key myself, before running the plink connection.
this works perfectly.
However, I want to do this fully automated.
Right now, I have to generate the value of that regkey first by running PuttY on a client, connecting manually, and copying the regkey.

To maintain our security, we want to send the SshHostKeys over a secure SSL connection, and set them in the registry every time before we connect. That way, the key would be verified, and get accepted.

Therefor, I need the value that Putty puts in the registry key.
I have the SSH Host key, but PuTTY seems to hash it, or encrypt it in some way, before it puts it in the registry.
How do they do that?
Using what algorithm/seed?

Simply put:
I have the server host key. How do I convert it into a registry key that PLink/PuTTY will accept?Start Free Trial
 
Loading Advertisement...
 
[+][-]03.16.2008 at 12:12AM PDT, ID: 21136024

Assisted solutions are selected by the member who asked the question as a comment that contributed to their question's solution.

Start your 7-day free trial to view this Assisted Solution or ask the Experts your question.

 
[+][-]03.16.2008 at 05:56AM PDT, ID: 21136717

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.17.2008 at 02:10AM PDT, ID: 21140631

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]03.17.2008 at 04:20AM PDT, ID: 21141190

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: SSH / Telnet Software, Algorithms
Tags: PuTTY, Putty/Plink, C#
Sign Up Now!
Solution Provided By: psyki_be
Participating Experts: 1
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628