Casper Langemeijer | 14 Jun 2012 22:28
Picon
Gravatar

Why does libssh2_userauth_publickey_fromfile_ex() require a public key?

Hi All,

A PHP user writes:

"Every other ssh client I've ever dealt with, only requires the private key to authenticate to a remote server with ssh2.

What is the reason for requiring both the public and private keys for authenticating, when in reality only the private key is required? The public key should be easily extracted from private key, and should be handled silently by PHP."

I think he raises an interesting point. What can you say on the subject?

For reference: https://bugs.php.net/bug.php?id=59409

Greetings, Casper

_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Joe Turpin | 19 Jun 2012 21:49
Picon

Re: Why does libssh2_userauth_publickey_fromfile_ex() require a public key?

On Thu, Jun 14, 2012 at 4:28 PM, Casper Langemeijer <casper-6Oomk7jYx+h73tVXQbUp5Q@public.gmane.org> wrote:
Hi All,

A PHP user writes:

"Every other ssh client I've ever dealt with, only requires the private key to authenticate to a remote server with ssh2.

What is the reason for requiring both the public and private keys for authenticating, when in reality only the private key is required? The public key should be easily extracted from private key, and should be handled silently by PHP."

I think he raises an interesting point. What can you say on the subject?

For reference: https://bugs.php.net/bug.php?id=59409

Greetings, Casper

Hi Casper,

It's not required. You can pass a NULL pointer in to the function for the public key file parameter and it will use the private key file parameter instead. 

--Joe
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel
Daniel Stenberg | 19 Jun 2012 22:09
Picon
Favicon
Gravatar

Re: Why does libssh2_userauth_publickey_fromfile_ex() require a public key?

On Tue, 19 Jun 2012, Joe Turpin wrote:

> It's not required. You can pass a NULL pointer in to the function for the 
> public key file parameter and it will use the private key file parameter 
> instead.

It was missing in the documentation though. I've just now added it!

--

-- 

  / daniel.haxx.se
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel

Peter Stuge | 20 Jun 2012 02:52
Picon

Re: Why does libssh2_userauth_publickey_fromfile_ex() require a public key?

Casper Langemeijer wrote:
> The public key should be easily extracted from private key

Tell the user that we would very much welcome a patch for libssh2
which does this also when linked against libgcrypt. It is obviously
not easy, or we would have done it long ago. Please send a patch.

//Peter
_______________________________________________
libssh2-devel http://cool.haxx.se/cgi-bin/mailman/listinfo/libssh2-devel


Gmane