-
Notifications
You must be signed in to change notification settings - Fork 374
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
NoMethodError: undefined method `group' for <xxxxx> #261
Comments
And I use ruby-v2.4.2 |
Hey @mackeee-orange, Thanks for the detailed reporting. Please try to give the Example: pub_key = OpenSSL::PKey.read(File.read('path_to_my_pub_key.pem'))
JWT.decode(payload, pub_key, true, my_options) |
@excpt Thank you for comment. Sorry, there is misunderstanding. |
@mackeee-orange you can generate a public key object from the string in the following way... # substitute public_key_octet_string with your string
ec = OpenSSL::PKey::EC.new('prime256v1')
key_bn = OpenSSL::BN.new(public_key_octet_string, 2) # 2 means binary
ec.public_key = OpenSSL::PKey::EC::Point.new(ec.group, key_bn)
#ec.public_key can be passed to JWT.decode |
thank you @ab320012 hex_string = "04xxxxx.....yyyyy......"
ec = OpenSSL::PKey::EC.new('prime256v1')
key_bn = OpenSSL::BN.new(hex_string, 16)
ec.public_key = OpenSSL::PKey::EC::Point.new(ec.group, key_bn)
JWT.decode @bearer_token, ec, true, { algorithm: 'ES256' } |
Versions:
I got a error when
JWT.encode
orJWT.decode
withES256
algorithm.When I exec them with 'none' algorithm, it spit success.
I show my pry:
How can I modify this problem??
The text was updated successfully, but these errors were encountered: