From: yermej Date: 2007-12-14T00:50:07+09:00 Subject: Re: Help with OpenSSL RSA On Dec 13, 9:24 am, Shandy Nantz wrote: > John Lane wrote: > > def generate_keys > > unless session[:private_key] > > k = RSA.new(128) > > session[:private_key] = k.to_pem > > session[:public_modulus] = k.public_key.n.to_s > > session[:public_exponent] = k.public_key.e.to_s > > > end > > @private_key = session[:private_key] > > @public_modulus = session[:public_modulus] > > @public_exponent = session[:public_exponent] > > end > > > I'd still like to be able to get this out of Ruby in Hex > > > If only I could find out the available methods in the RSA class (as I > > said before the RDoc does not include anything about this class). > > > Thanks! > > Did this ever get resolved? This is the exact problem that I am trying > to solve. Thanks, > > -S > -- > Posted viahttp://www.ruby-forum.com/. This seems to work if you want it as a hex string: key = OpenSSL::PKey::RSA.new(1024) private_key = key.to_pem public_modulus = key.public_key.n.to_s(16) public_exponent = key.public_key.e.to_s(16)