garyf / json_web_token_ex

An Elixir implementation of the JSON Web Token (JWT) Standard, RFC 7519
MIT License
143 stars 50 forks source link

Erlang OTP 20 breaks JsonWebToken.Algorithm.Rsa.validate_key_size/1 #20

Closed BrendonPierson closed 7 years ago

BrendonPierson commented 7 years ago

It appears the latest erlang release has removed :crypto.mpint/1. This is causing the JsonWebToken.Algorithm.Rsa.validate_key_size/1 to break. I think we will need a work around for validating key size.

lachezar commented 7 years ago

As a temporary solution I created a erl file with the mpint/1 implementation. I am not sure if there is a proper function in crypto or in other modules which can replace mpint/1 (I am not experienced with Erlang), but I can make a PR if this solution is good enough.

https://github.com/lachezar/json_web_token_ex/commit/e9b0fafdedcceb2c19505ab864f662995e9ce594

BrendonPierson commented 7 years ago

I've played around with it a bit and it looks like :crypto.mpint/1 was just moved to :ssh_bits.mpint/1. I'm not sure on the best practice here, but It's probably wise to run some logic that picks the correct version based on the erlang version.

Here is a simple workaround that runs a check for the Erlang version and picks the right function -> #21

lachezar commented 7 years ago

Looks very clean and nice!!