Subject: Re: SSH2 host key length and hash compute

Re: SSH2 host key length and hash compute

From: Kalpesh Parekh <kalpesh.ork2_at_gmail.com>
Date: Tue, 2 Jul 2013 07:03:59 -0700

>From: Alexander Lamaison <swish_at_lammy.co.uk<swish_at_lammy.co.uk?Subject=Re:%20SSH2%20host%20key%20length%20and%20hash%20compute>>

>Date: Tue, 2 Jul 2013 09:57:53 +0100

*>*On 2 July 2013 07:34, Kalpesh Parekh <kalpesh.ork2_at_gmail.com> *>*wrote:

*> Hi Alex *
*> *
*> The APIs I am using are libssh2_session_hostkey to retreive the host
>key and *
*> libssh2_hostkey_hash to compute the hash from the key. *
*> *
*> The first API returns the length of the host key in a variable passed to
>it *
*> as a function argument. The variable is of size_t type and indicates
>the *
*> size of host key. I need to convert this value to bits. Can you let me
>know *
*> how can I do this? *
*>*Why do you need to convert it to bits? What does that actually mean?
*>*The size_t length is just a number.

The requirement is to show the strength of the host key in bits. I assumed
the length of the host key should be indicating this value and tried to
convert it to bits from size_t. How does ssh-keygen -l calcuate the
strength in bits?

*> This variable is passed to the second api and the hash is returned. *

*>*Have you read the documentation?

*>*http://www.libssh2.org/libssh2_hostkey_hash.html
*>*http://www.libssh2.org/libssh2_session_hostkey.html
*>*The two functions are unrelated. You do not pass the output from one
*>*as the input to the other.

Thanks for the correction. I gave you incorrect information here. But my
code is implemented as per the API documentation.

*> Here *
*> based on the type of host key, if it is RSA I request for the md5 hash
and *
*> sha1 hash for DSS key. Let me know if my assumption is correct here *
*>*You can request MD5 or SHA1, as you wish, independent of the key *>*type.

Thanks. This information is helpful.

*>*Alex

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