Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@rchekaluk
Copy link
Collaborator

This is a next step towards fuller ECDSA support, leveraging the initial work done in branch ec. It's not complete, but I thought I'd send this PR in advance in case you may have any initial feedback.

I manually refreshed branch ec from master prior to adding new functionality.

Three tests are currently failing, which may be due to its lack of correct support for ssh_public_key_bits (since it is a branch off master).

bensie and others added 30 commits September 20, 2016 10:01
Validate ECDSA and Ed25519 pub keys (elliptic curve)
```
/home/pocke/ghq/github.com/bensie/sshkey/test/sshkey_test.rb:264: warning: assigned but unused variable - public_key1
/home/pocke/ghq/github.com/bensie/sshkey/test/sshkey_test.rb:265: warning: assigned but unused variable - public_key2
/home/pocke/ghq/github.com/bensie/sshkey/test/sshkey_test.rb:266: warning: assigned but unused variable - public_key3
/home/pocke/ghq/github.com/bensie/sshkey/lib/sshkey.rb:124: warning: assigned but unused variable - source_format
```
```
/home/pocke/ghq/github.com/bensie/sshkey/test/sshkey_test.rb:388: warning: mismatched indentations at 'end' with 'def' at 379
```
```
/home/pocke/ghq/github.com/bensie/sshkey/lib/sshkey.rb:234: warning: constant OpenSSL::Cipher::Cipher is deprecated
/home/pocke/ghq/github.com/bensie/sshkey/lib/sshkey.rb:38: warning: constant OpenSSL::Cipher::Cipher is deprecated
```
Bump up Ruby version in Travis CI
as per

      https://tools.ietf.org/html/rfc4255
      https://tools.ietf.org/html/rfc6594

this is similar to

     ssh-keygen -r localhost -f /etc/ssh/ssh_host_rsa_key
* lib/sshkey: accept valid ed25519 keys with leading zero byte

* Add test case for 31 byte ed25519 key
MangyCoyote and others added 7 commits May 18, 2020 07:22
* SSH public keys not validated/parsed if contain comments

* SSH public keys not validated/parsed if contain comments
* add failing test case for #35

* Determine ECDSA bit lengths fixes #35

Co-authored-by: James Miller <[email protected]>
Co-authored-by: Rob Chekaluk <[email protected]>
@rchekaluk
Copy link
Collaborator Author

After merging (recently-updated) master branch into ec, the test suite is down to 2 failures.

@bensie
Copy link
Owner

bensie commented Jan 8, 2021

@rchekaluk You've been busy! Let's not go too far here with the C extension. I'd like to steer clear of anything that resembles rolling our own crypto and keep this in pure Ruby. Old Ruby version support isn't worth a massive increase in complexity. Thanks for your work so far!

@rchekaluk
Copy link
Collaborator Author

rchekaluk commented Jan 8, 2021

Introduction to commit a105960
This commit adds a C extension to provide OpenSSL::PKey::EC::Point#to_octet_string for use in Rubies that don't have it
(except JRuby, which doesn't support C extensions). to_octet_string supplies ECDSA Q, which is required in order to pack an ECDSA public key. to_octet_string was added in ruby/openssl in version 2.1.0 (which is bundled beginning with the Ruby 2.5 standard library).This C extension largely captures to_octet_string functionality from the current library, thus making it available to earlier versions of Ruby (noting that this is primarily interfacing glue; the actual crypto work is implemented within the native OpenSSL library).

JRuby support for ECDSA is currently incomplete:

Consequently, various test cases raise NotImplementedError when run under JRuby.

@bensie
Copy link
Owner

bensie commented Jan 8, 2021

@rchekaluk If Ruby 2.5 is the beginning of built-in support for ECDSA, let's just have that be where the line is drawn for ECDSA support. 2.4.x and older are no longer supported anyway. This adds an immense amount of complexity for Ruby versions that are already EOL.

@rchekaluk
Copy link
Collaborator Author

Understood @bensie. I figured I'd put it out there for review and learn something in the process.

Unless objections, I can raise the minimum Ruby, and re-apply only the aspects that are needed for JRuby to succeed.

@bensie
Copy link
Owner

bensie commented Jan 14, 2021

@rchekaluk Be sure to let me know when this is ready!

@rchekaluk
Copy link
Collaborator Author

Ready. I have incorporated this branch into my dev environment and it is working fine.

Note: the PR merely merges into branch ec

@rchekaluk
Copy link
Collaborator Author

Ready @bensie

@rchekaluk
Copy link
Collaborator Author

@bensie Any prospects for a merge?

@bensie bensie merged commit 6fd3992 into bensie:ec Mar 11, 2021
@bensie bensie mentioned this pull request Mar 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.