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 1.2.2.13 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… :-)

About these ads
About

hi there, I am software engineer, working in e-commerce company and passionate about all thing digital. On this blog, I share my experiments with different technology.

Posted in .Net

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 34 other followers

%d bloggers like this: