I’m trying to create a very simple & lightweight client implementation of the SSH protocol for node.js.
The following documentation confuses me totally:
http://www.snailbook.com/docs/transport.txt
It lacks a full example of the whole key exchange thing. There are many things well explained, but I’m not really sure how to put those things together.
Could you help me to put an example together?
I’m stuck after section 7.1. I successfully receive the list of alorightms of the server, and I send a list with only the required alorithms to the server. Also successful.
So, in this case we have the following alorightms:
- kex: diffie-hellman-group1-sha1
- key: ssh-dss
- encryption: 3des-cbc
- mac: hmac-sha1
After that, I skipped section 7.2 and 7.3 and continued directly to section 8, since generating a key needs the values H & K, which are generated in section 8.
But section 8 does not make sense to me. It requires both the client & the server to already know the same prime, generator and order value. When have those values been negotiated an sent to each other? Section 8 cleary says that it directly follows the algorithm exchange, so there is nothing between those steps…
Am I missing something?
Thanks really much for your help!
The prime is specified by the key-exchange algorithm. For example, to quote from your source:
And if you consult RFC 2409 §6.2, you’ll find: