jruby / jruby-openssl

JRuby's OpenSSL gem
http://www.jruby.org
Other
47 stars 80 forks source link

OpenSSL::PKey::RSA missing #public_to_der #298

Open segiddins opened 6 months ago

segiddins commented 6 months ago
#!/usr/bin/env ruby

require 'rubygems'
require 'openssl'

b64 = "MFkwEwYHKoZIzj0CAQYIKoZIzj0DAQcDQgAE2G2Y+2tabdTV5BcGiBIx0a9fAFwrkBbmLSGtks4L3qX6yYY0zufBnhC8Ur/iy55GhWP/9A/bY2LhC30M9+RYtw=="

key = OpenSSL::PKey.read(b64.unpack1("m"))

pp OpenSSL::Digest::SHA256.hexdigest(key.public_to_der)

passes on MRI, fails on jruby (JRuby-OpenSSL 0.14.5):

NoMethodError: undefined method `public_to_der' for #<OpenSSL::PKey::RSA:0x5a1c7619>
  <main> at Untitled 2.rb:10
segiddins commented 1 month ago

So is OpenSSL::PKey::EC