Subject: libssh2_userauth_publickey


From: Ted Lemon <>
Date: Wed, 18 Aug 2010 10:51:55 -0400

On Aug 18, 2010, at 4:52 AM, Paresh Thakor wrote:
> I'm also working on libssh2 API. And my issues is with libssh2_userauth_publickey_fromfile(). I'm using apple's sample code with
> - (void)generateKeyPairPlease{
> }

Prakesh, if you look in src/userauth.c, you can see that there's an API function, libssh2_userauth_publickey, which sort of does what you want. You would have to write a callback function, analogous to the sign_fromfile() function in userauth.c, which would do the signature using the private key that you've generated, rather than loading the private key from a file. You should be very careful to use good virtual memory hygiene when using private keys--make sure the private key isn't written to swap, and that it's not readable by another process.

Received on 2010-08-18