I have an RSA public key module and an exponent string.
I want to create OpenSSL::PKey::RSAfrom these two lines.
They mainly come as:
- n = 'long string'
- e = '4-character string'
How would I do this in Ruby? The ultimate goal is to deliver this to the JWT gem.
Update
I am currently in Ruby 2.3.1, so this works:
key = OpenSSL::PKey::RSA.new
key.e = OpenSSL::BN.new(Base64.decode64(e), 2)
key.n = OpenSSL::BN.new(Base64.decode64(n), 2)
However, it will not work during the upgrade.
source
share