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

Implement Elliptic Curve Crypto Signatures #74

Merged
merged 1 commit into from
May 9, 2015

Conversation

jtdowney
Copy link
Contributor

The JSON Web Algorithms draft specifies three algorithms for signatures using the Elliptic Curve Digital Signature Algorithm (ECDSA). This pull request adds support for:

  • ES256 - ECDSA using P-256 and SHA-256
  • ES384 - ECDSA using P-384 and SHA-384
  • ES512 - ECDSA using P-521 and SHA-512

@excpt excpt added this to the Version 1.5.0 milestone Apr 17, 2015
@excpt
Copy link
Member

excpt commented Apr 17, 2015

Thank you very much!

Code review in progress. :)

@@ -37,10 +45,22 @@ def sign_rsa(algorithm, msg, private_key)
private_key.sign(OpenSSL::Digest.new(algorithm.sub('RS', 'sha')), msg)
end

def sign_ecdsa(algorithm, msg, private_key)
raise IncorrectAlgorithm unless NAMED_CURVES[algorithm] == private_key.group.curve_name
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that I look back at this. It would probably be better to raise this with a more helpful message.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feel free to extend you PR.

I can tag it as WIP if you want to. :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sounds good, I'll update my branch. It shouldn't take me very long.

The JSON Web Algorithms draft specifies three algorithms for signatures
using the Elliptic Curve Digital Signature Algorithm (ECDSA).

* ES256 - ECDSA using P-256 and SHA-256
* ES384 - ECDSA using P-384 and SHA-384
* ES512 - ECDSA using P-521 and SHA-512
@excpt excpt added the WIP label Apr 17, 2015
@jtdowney
Copy link
Contributor Author

@excpt I've pushed an update that includes the better error message

@excpt
Copy link
Member

excpt commented Apr 17, 2015

👍

excpt added a commit that referenced this pull request May 9, 2015
Implement Elliptic Curve Crypto Signatures
@excpt excpt merged commit 27fb05a into jwt:master May 9, 2015
@excpt excpt removed the WIP label May 10, 2015
@excpt
Copy link
Member

excpt commented May 10, 2015

@jtdowney Thank you for the contribution. Merged and released in version 1.5.0. :) 🍻

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

Successfully merging this pull request may close these issues.

2 participants