questions about SSH1_SMSG_PUBLIC_KEY packet
- From: "yawnmoth" <terra1024@xxxxxxxxx>
- Date: 17 Jan 2006 00:31:39 -0800
In SSH v1, the first binary packet sent out is of the type
SSH_SMSG_PUBLIC_KEY. The protocol docs describe the packet thusly:
8 bytes anti_spoofing_cookie
32-bit int server_key_bits
32-bit int host_key_bits
32-bit int protocol_flags
32-bit int supported_ciphers_mask
32-bit int supported_authentications_mask
Sent as the first message by the server. This message gives
server's host key, server key, protocol flags (intended for
patible protocol extension), supported_ciphers_mask (which is
the bitwise or of (1 << cipher_number), where << is the left
shift operator, for all supported ciphers), and
supported_authentications_mask (which is the bitwise or of (1
authentication_type) for all supported authentication types).
The anti_spoofing_cookie is 64 random bits, and must be sent
back verbatim by the client in its reply. It is used to make
IP-spoofing more difficult (encryption and host keys are the
real defense against spoofing).
My question is... what's the point of server_key_bits and
host_key_bits? At first, I thought it might be to specify the size of
the multiple-precission integer field, but looking back at the
description of the multiple-precission integer field, I see that the
length is already taken care of:
First 2 bytes are the number of bits in the integer, msb first
(for example, the value 0x00012345 would have 17 bits). The
value zero has zero bits. It is permissible that the number of
bits be larger than the real number of bits.
The number of bits is followed by (bits + 7) / 8 bytes of
data, msb first, giving the value of the integer.
So... my question would still seem to stand. What's the point of
server_key_bits and host_key_bits?
The SSH v1 documentation (from which the above quotations are made) can
be found here: