joana wrote:
> $fp = fopen(...);
> $pKey = fread($fp, filesize(...));
> openssl_public_encrypt($data, $enc, $pKey);
> return base64_encode($enc);

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

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to