Subject: Re: SSH2 host key length and hash compute

Re: SSH2 host key length and hash compute

From: Alexander Lamaison <swish_at_lammy.co.uk>
Date: Mon, 1 Jul 2013 22:11:35 +0100

On 1 July 2013 20:55, Kalpesh Parekh <kalpesh.ork2_at_gmail.com> wrote:
> Hi
>
> The values returned by libssh2_host_key is returned as size_t. How can I
> convert it to bits. I seem to be getting 23 additional bytes and therefore
> have used (size returned - 23) *8.

There is no libssh2_host_key? Do you mean libssh2_hostkey_hash or
libssh2_session_hostkey?

> Also when computing the hash I have used md5 for RSA and sha1 for DSS. Is
> this the correct way?

You mention hashes so I'm going to assume you meant
libssh2_hostkey_hash. I don't know why you think it returns a value
as size_t. The return is a const char* string and the size is either
16 bytes or 20 bytes depending on whether you requested MD5 for SHA1.

Alex
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Received on 2013-07-01