RSA cryptography: data exchange between C# and PHP

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
julotte
Forum Newbie
Posts: 2
Joined: Sun Jun 06, 2010 5:03 am

RSA cryptography: data exchange between C# and PHP

Post by julotte »

Hello everyone,

I have got a problem I can't manage to sort out, I hope I am in the right board to post it.

I try to exchange data between a C# client application and a PHP server script. I would like these data to be encrypted by RSA algorithm.

On PHP side, that's easy: I use php openssl functions.
On C# side, that's easy too: I use Rsacryptoserviceprovider library.

But things are getting complicated when I try to make both communicate. And it starts since the beginning because private RSA key generated by openssl are in PEM or DER format while private RSA key generated by Rsacryptoserviceprovider are in a XML format.

How can I convert a key from a format to an other? I look for that answer everywhere and I didn't find it...

Thank you very much for your help!
Post Reply