Home » U++ Library support » U++ Core » HowTO use Core/SSH with PRIV/PUB Keys ?
HowTO use Core/SSH with PRIV/PUB Keys ? [message #60709] |
Fri, 26 July 2024 17:53  |
omari
Messages: 276 Registered: March 2010
|
Experienced Member |
|
|
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"
regards
omari.
|
|
|
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: 1211 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
|
|
|
|
Re: HowTO use Core/SSH with PRIV/PUB Keys ? [message #60713 is a reply to message #60711] |
Mon, 29 July 2024 08:22   |
omari
Messages: 276 Registered: March 2010
|
Experienced Member |
|
|
Hi,
i have successfully connected using ed25519 private key.
ssh-keygen -t ed25519 -f mykey_ed25519
this confirm that the problem concern only RSA.
after further search i found that:
- libssh2 <= 1.10 use RSA_SHA1 as signing algorithm.
- RSA_SHA1 is unsecure and depracted then default to rejected by ssh servers.
- this is fixed in 1.11 version (i hope):
Adds RSA-SHA2 key upgrading to OpenSSL, WinCNG, mbedTLS, OS400 backends
regards
omari.
|
|
|
Re: HowTO use Core/SSH with PRIV/PUB Keys ? [message #60716 is a reply to message #60713] |
Mon, 29 July 2024 11:52  |
Oblivion
Messages: 1211 Registered: August 2007
|
Senior Contributor |
|
|
Hello Omari
Quote:after further search i found that:
- libssh2 <= 1.10 use RSA_SHA1 as signing algorithm.
- RSA_SHA1 is unsecure and depracted then default to rejected by ssh servers.
- this is fixed in 1.11 version (i hope):
Nice to know that it worked for you!
FYI, libssh2 1.11.0 introduced some bugs (a few of them are serious) and regressions (They did a massive cleanup and they are still cleaning up the older and unsafe code, so it was somewhat expected.).
I am going to update the underlying libssh2 library in SSH package to v1.11, once the 1.11.1 becomes official (It is around the corner).
Thank you for your patience.
Best regards,
Oblivion
Github page: https://github.com/ismail-yilmaz
Bobcat the terminal emulator: https://github.com/ismail-yilmaz/Bobcat
[Updated on: Mon, 29 July 2024 11:54] Report message to a moderator
|
|
|
Goto Forum:
Current Time: Wed Jun 11 14:44:08 CEST 2025
Total time taken to generate the page: 0.04509 seconds
|