3

Possible Duplicate:
Cross platform (php to C# .NET) encryption/decryption with Rijndael

How can I encrypt something in .NET and decrypt it in PHP?

Community
  • 1
  • 1
user690932
  • 419
  • 2
  • 7
  • 19
  • 1
    It's not clear, what you mean by "best". You can use any two-way encryption algorithm for which there exists an implementation in PHP and C#... – Daniel Hilgarth Apr 04 '11 at 10:48
  • You should never encrypt passwords with an technology that lets you decrypt it again. – Jan Sverre Apr 04 '11 at 10:49
  • @Daniel , Hi can u sugesst two way algorithm that can be used for encrypting in .net and decrypting using php – user690932 Apr 04 '11 at 10:51
  • @Jannis: I don't agree. There are several use cases where you need to decrypt the passwords. For example: You store the password to your database in the config file. One way encryption won't help you here. – Daniel Hilgarth Apr 04 '11 at 10:51
  • @user690932: No, I don't use PHP – Daniel Hilgarth Apr 04 '11 at 10:51
  • what about using RC4, its two way & widely used can be adapted to any lang. i have an example if you want to see – Lawrence Cherone Apr 04 '11 at 10:56
  • I don't see why the language matters. Everything that you encrypt in .NET can be decrypted in PHP as long as you have the key and a correct implementation of the algorithm you used to encrypt. What is your actual question? Is it which algorithm to use? – AVH Apr 07 '11 at 15:03

1 Answers1

6

You can encrypt/decrypt cross-platform using the TripleDES symmetric encryption algorithm.

This URL provides a working sample: PHP and C# common encryption and decryption function class, Use of 3DES encryption and decryption

dhirschl
  • 2,088
  • 13
  • 18
  • This link is now spam, and I suspect it's trying to install a malicious Chrome Extension. – Tod Sep 21 '17 at 13:07