Given that the actual encryption is handled by OpenSSL on both sides, I
would expect you are still missing some configuration difference. Either
in the algorithms used or as hinted in the padding being used. There
could also possible be some difference in the Base64 encoding/decoding,
but likely not. One other remote possibility might be the character
encoding that’s used which writing/reading the Base64 strings.
That’s about all I can think of right away. The key thing here though is
if OpenSSL is truly setup the same way on both sides it should work.
I was also wondering why you chose a public key encryption over using a
symmetric key. Are you doing some form of key exchange between the two
applications? Of course, this might be perfectly logical in your case,
but I would typically go with a symmetric algorithm (such as AES) to
both dramatically increase the encryption speed and eliminate the key
exchange phase.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.