Aaron Patterson wrote:
> On Wed, Aug 08, 2007 at 07:05:22AM +0900, Starfry Starfry wrote:
>> key = RSA.new(1024)
>> not seem to work.
> How about Base64 ecoding?
> 
>   [key.public_key.n.to_s].pack('m')

I could not get pack to work as you described. My code is below. I have 
taken a different tack, to get my Javaption side to work with the 
modulus and exponent in decimal.

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!
-- 
Posted via http://www.ruby-forum.com/.