From: Brian Candler Date: 2008-10-18T00:20:42+09:00 Subject: Re: RSA public_encrypt bug? Dani Pardo wrote: > Hi, I'm trying to encrypt some data with an RSA public key, this is > the code which is failing: Your life might be easier if you read your public key from a PEM file :-) I don't know why your code doesn't work. However I have attached some code I wrote about 4 years ago which I used to construct a key from its parameters (before writing it out as a PEM). It seems you're doing the right things, but maybe the comments are relevant. I think I was using integers, so perhaps f.gets.to_i ? Also, you could try writing out a PEM, and then using that at the openssl command line, to check that your key is actually valid. Attachments: http://www.ruby-forum.com/attachment/2828/rsa_new.rb -- Posted via http://www.ruby-forum.com/.