lindelius/php-jwt

Add support for ES algorithms

Closed this issue · 6 comments

The library is currently missing support for the recommended elliptic curve algorithms ES256, ES384, and ES512.

Hi @lindelius, I have some questions about this issue.

  • Do we need to implement this feature for this package?
  • Can we include the ES libraries to support this feature?

Thanks.

Hi @peter279k,

Thank you for showing interest in the library.

The ideal contribution would implement the missing algorithms in a similar fashion to https://github.com/lcobucci/jwt and https://github.com/web-token/jwt-framework, and without requiring any external libraries or creating any additional classes.

Hi @lindelius, thank you for your reply.

After looking at the repos that you mention, I think they use the additional ECC package to complete this featutre.

The lcobucci/jwt uses the phpecc library.

And the web-token/jwt-framework uses the sub repo in this main repo.

You should check that.

@peter279k, Thank you for taking the time to dig around.

I have done some thinking and while I'm still against adding any external libraries (extensions would be OK) I did end up reworking the algorithm support to make it more extendable. The updated code is in the extendable-algorithm-support branch, and if you have the time I would appreciate your input.

I haven't started on any EC implementations, but the rework should make adding this easier. The idea is to add the necessary traits, and, if necessary, additional classes, as well.

@lindelius, thank you for your reply.

After looking at the extendable-algorithm-support branch, it seems that you want to create the ES256, ES384 and ES512 classes without any php-ecc package/dependencies.

I think it's fine to use this approach you mention to complete this feature.

But I think we need to keep this ES functionality simple and lightweight.

I will refer that branch and create the PR for this issue and let you review that.

Thanks :).

@lindelius, I also refer this psecio/jwt repo to implement this ES algorithm support.

Please check that, thanks.