From: Brian Candler Date: 2010-09-01T20:09:47+09:00 Subject: Re: rsa sign and verify with openssl on windows I suggest you generate a new throw-away private key, then you can post the private key, complete programs in Ruby and Java and the openssl command line version to replicate the problem, and the exact outputs you see. Also break it down bit by bit. p data.bytesize # same as in Java? p digest # should be 20 bytes, is it same as you get in Java? p private_key.private_encrypt(digest) > After some inspection, i've extracted public key from priv.pem with > openssl in PEM format and tried private_key.public_key() which also > returns a public key in PEM format, but it is different! Again, would like to see this replicated. On those two PEM files, try somethine like openssl rsa -in foo.pem -pubin -noout -text to see how/if the contents are different. > I also tried to sign and verify with the same keys using openssl command > line tool and were successful. So show the openssl command lines you used, then we can see if what you're doing in Ruby is different. > Data has only ASCII characters although let's not forget that in Java > UTF-8 is default. Could there be any encoding issues? Seems unlikely. Data is data, and Ruby's openssl wrapper isn't going to be transcoding stuff before giving it to openssl (I'd certainly hope not anyway) -- Posted via http://www.ruby-forum.com/.