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 18.104.22.168 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 system.security.cryptography 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… 🙂