Reputation: 6394
I'm trying to find an AES encryption method that will allow me to encrypt a string in PHP and use the encrypted string to be decrypted in C#
Can anyone help me out here. I've looked at nearly all the examples on the net and can't find a matching one that will let me do what I want.
Thanks
Upvotes: 0
Views: 2181
Reputation:
I would recommend phpseclib, a pure PHP AES implementation. It's interoperable with OpenSSL as demonstrated thusly:
AES Encrypt in PHP to decrypt in openssl
Upvotes: 2
Reputation: 56490
The problem with PHP is that mcrypt only supports null padding. C# does not support null padding for good reason, it goes haywire if you're encrypting binary information. If you switch to OpenSSL for your encryption on PHP you will get better padding options. Once you have switched you simply need to ensure the block size, mode and padding options are the same on both sides.
Upvotes: 6