Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for ECDH key exchange #41

Closed
bk2204 opened this issue Sep 6, 2015 · 14 comments
Closed

Add support for ECDH key exchange #41

bk2204 opened this issue Sep 6, 2015 · 14 comments

Comments

@bk2204
Copy link
Contributor

bk2204 commented Sep 6, 2015

ECDH key exchange is faster than regular Diffie-Hellman with equivalent levels of security. It's been supported for some time in OpenSSH. It also uses longer session hashes, resulting in harder-to-guess key material. It would be nice if libssh2 supported this as well.

The NIST curves can probably be trivially implemented with OpenSSL and libgcrypt, but using curve25519-sha256@libssh.org would probably require custom code in libssh2.

@svoop
Copy link

svoop commented Oct 27, 2015

Slightly off-thread: Will Cosgrove worked on diffie-hellman-group-exchange-sha256 support back in January:
http://www.libssh2.org/mail/libssh2-devel-archive-2015-01/0004.shtml

@fgouget
Copy link

fgouget commented Feb 25, 2016

This is getting somewhat urgent. libssh2 only supports the following key exchange protocols: diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group1-sha1

But OpenSSH now disables diffie-hellman-group1-sha1 by default, and SHA1 in general is considered broken so the rest of libssh2's key exchange protocols are bound to follow suite. Indeed some SSH hardening guides recommend only supporting curve25519-sha256@libssh.org and diffie-hellman-group-exchange-sha256, neither of which libssh2 supports.

@bagder
Copy link
Member

bagder commented Feb 25, 2016

We accept pull requests as well as good old patches mailed to the mailing list.

@jakob
Copy link
Contributor

jakob commented Feb 25, 2016

@fgouget libssh2 does support diffie-hellman-group-exchange-sha256 in the most recent version (1.7.0). The website hasn't been updated yet with this info.

@Badger Could you update the website to include this info?

@bagder
Copy link
Member

bagder commented Feb 25, 2016

done!

@willco007
Copy link
Member

I have ECDH using OpenSSL support done on a private fork; I just need some time to merge it back into master and create a pull request.

@prem-nm
Copy link

prem-nm commented May 16, 2017

I am also looking for ECDH support in libssh2. Hope you find the time to merge back your changes :-)

@ehamberg
Copy link

Any news on this, @willco007? :)

@willco007
Copy link
Member

@ehamberg Thanks for the reminder. I finally shipped the project I've been working on and will have some time in the coming weeks to get my changes into a pull request.

I've been continuing to work on my private fork. I've recently added OpenSSH key file format support. At this point I have diverged quite a bit from the official release (ECDHA, ED25519, ETM support, OpenSSH keys). The problems are:

  1. my changes are numerous; someone needs to review them for the project in a timely manor
  2. the crypto-related changes only work using OpenSSL
  3. getting someone who uses the other crypto backends to make sure they don't blow up and/or getting them ported to those backends. Any takers out there? :)

@prem-nm
Copy link

prem-nm commented Aug 30, 2017

I've implemented ECDH nistp384 on my local sandbox. I have tested this against openssh 7.3p1. Mine too works only with openssl. I can review the ECDH code. I've never used gcrypt etc , so I won't be of much help

@willco007
Copy link
Member

@prem-nm great! I'm merging my changes now and will let you know when I submit the pull request.

willco007 added a commit to willco007/libssh2 that referenced this issue Aug 31, 2017
Only supported using OpenSSL backend at the moment
@willco007
Copy link
Member

@prem-nm have you had a chance to look over/try my pull request?

@prem-nm
Copy link

prem-nm commented Sep 11, 2017

@willco007 , I had a look and I have commented. Good job !

vszakats pushed a commit that referenced this issue Mar 9, 2018
This commit lands full ECDSA key support when using the OpenSSL
backend. Which includes:

New KEX methods:
ecdsa-sha2-nistp256, ecdsa-sha2-nistp384, ecdsa-sha2-nistp521

Can now read OpenSSL formatted ECDSA key files.

Now supports known host keys of type ecdsa-sha2-nistp256.

New curve types:
NID_X9_62_prime256v1, NID_secp384r1, NID_secp521r1

Default host key preferred ordering is now nistp256, nistp384,
nistp521, rsa, dss.

Ref: #41

Closes #206
@willco007
Copy link
Member

ECDSA support has been merged in, closing.

kbulgrien pushed a commit to kbulgrien/libssh2-1.2.4-sco3.2v5.0.7 that referenced this issue Dec 14, 2018
This commit lands full ECDSA key support when using the OpenSSL
backend. Which includes:

New KEX methods:
ecdsa-sha2-nistp256, ecdsa-sha2-nistp384, ecdsa-sha2-nistp521

Can now read OpenSSL formatted ECDSA key files.

Now supports known host keys of type ecdsa-sha2-nistp256.

New curve types:
NID_X9_62_prime256v1, NID_secp384r1, NID_secp521r1

Default host key preferred ordering is now nistp256, nistp384,
nistp521, rsa, dss.

Ref: libssh2#41

Closes libssh2#206
alex-weaver pushed a commit to alex-weaver/libssh2 that referenced this issue Mar 23, 2023
This commit lands full ECDSA key support when using the OpenSSL
backend. Which includes:

New KEX methods:
ecdsa-sha2-nistp256, ecdsa-sha2-nistp384, ecdsa-sha2-nistp521

Can now read OpenSSL formatted ECDSA key files.

Now supports known host keys of type ecdsa-sha2-nistp256.

New curve types:
NID_X9_62_prime256v1, NID_secp384r1, NID_secp521r1

Default host key preferred ordering is now nistp256, nistp384,
nistp521, rsa, dss.

Ref: libssh2#41

Closes libssh2#206
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants