Auth with two private keys

0 admin at
Wed Feb 9 13:07:47 CET 2022

Hello. I asked this question on github and the developer said to ask me
this via email.
I know this is not so right place to ask, but I have no choice...
I am using libssh2 and connecting to the server with pem cert file, it
works fine.
But now I have a new requirement: I need to authorize with two identity
file simultaneously. Two separate private keys.
Server requires from client to provide two different keys for auth.
If I would do this with console shh client, it would look like this: ssh -i
/keys/first.pem -i /keys/second.pem user at host
Two keys, one user session. Does it even possible with libssh2? And if yes
- how to do this?
And if not possible - can you give me any hints where and how I can
implement it?

And your reply says:
There is a libssh2 dev email list for questions like this, found at As for your question, you'll receive multiple calls to the
user auth callback where you can provide multiple pem files.

So can you please give me a detailed answer about this. What callback was
mented? sign_fromfile/sign_frommemory from userauth.c ? How exactly do I
have to provide a second key? I have to add public key extraction logic for
the second private key and modify every function for auth where the key is
used or it can be solved in a more simple way? Can you give me please more
detailed hints about how to implement this.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the libssh2-devel mailing list