On Fri, Oct 17, 2008 at 6:04 PM, Brian Candler <b.candler / pobox.com> wrote: > > Aha! OpenSSL::BN reads decimal, not hex! Remember that irb is your > friend: > > irb(main):001:0> require 'openssl' > => true > irb(main):002:0> x = OpenSSL::BN.new("1234") > => 1234 > irb(main):003:0> x = OpenSSL::BN.new("12AB") > => 12 > > So try changing your code to: > > rsa.n = OpenSSL::BN.new(f.gets.to_i(16).to_s) > Woops, you're true, that was the problem!. I thought OpenSSL::BN would read hex. It reads an string that should be on base10. Strange though that it wasn't raising an exception. Thanks! -- Dani