AES interop between .Net, Java and PHP

Hi all,

Few months ago I came accorss really interesting problem of AES encryption interoperability between .net, java and PHP language.

Means, Encrypt data in one platform and decrypt in another one. we also have limitation that the current system was using java not the latest version of JAVA.

The current version of Java have AES support in native language. But not in Java 1.2.213.

Then how do we solve it ?

for .net we use namespace to use rijandale algorithm with fixed length key 128 bit, cipher mode cbc and padding method pkcs7. And use IV as zero byte array. In .net we have to explicitly tell rijandle to use IV other wise it will generate different IV every time.

For php we have used  AES extension of PHP.

But for Java I have found one article on Cryptography which has AES implementation in it.

And the great thing is it really worked when you convert plaint text with key and get the out put in Hex String.

And Use the hex string in either Java or PHP and try to decrypt with same key.

Interesting isn’t it… 🙂


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s