Home » U++ Library support » U++ Core » HowTO use Core/SSH with PRIV/PUB Keys ?
Re: HowTO use Core/SSH with PRIV/PUB Keys ? [message #60710 is a reply to message #60709] |
Sat, 27 July 2024 08:58   |
Oblivion
Messages: 1221 Registered: August 2007
|
Senior Contributor |
|
|
Hi omari,
Quote:Hi,
I want to connect to server that accept only private key authentification.
I can connect using command line :
ssh -i ./id_rsa user@ServerIP
but with Core/SSH, i have tryed without success.
SshSession session;
String priv = "C:\Users\user\.ssh\id_rsa";
String pub = "C:\Users\user\.ssh\id_rsa.pub";
session.HostBasedAuth().Keys(priv, pub, "", true ).Connect("ssh://user@ServerIP");
session.GetErrorDesc() return "Invalid signature for supplied public key, or bad username/public key combination"
session.PublicKeyAuth().Keys(priv, pub, "", true ).Connect("ssh://user@ServerIP");
session.GetErrorDesc() return "Username/PublicKey combination invalid"
libssh2 can compute public key from private key, but it wasn't enabled in Upp::SSH package (till now). I have pushed the patches to my fork of the latest upp.
If you could check and confirm that it works, I'll make a pull request and patch the code in Upp main branch.
(All you need to do is pass an empty or null String as public key.)
Best regards,
Oblivion
Github page: https://github.com/ismail-yilmaz
Bobcat the terminal emulator: https://github.com/ismail-yilmaz/Bobcat
|
|
|
Goto Forum:
Current Time: Thu Aug 07 01:51:39 CEST 2025
Total time taken to generate the page: 0.03731 seconds
|