I have an encryption service (.Net Class Lib) now i have to port it to java, as far as the encryption and decryption goes both the services are serving fine but the problem is that i have to save the encrypted value in the database and the encryption value generated by the java service must match the value generated by the .Net class lib.
Now if i encrypt a value say android both the services generate different encrypted values. What are the possible workarounds or thing to look for…
An encryption system generally has these parameters:
A system can be developed using any language and on any platform, and provided those three things are the same then the outputs from any implementation will be identical. Things like platform endianness don’t matter as algorithms should use the byte as the base unit.
Ergo, if you’re getting different outputs for the same input then one or more of those things is wrong 🙂
If you have developed your own encryption system (e.g. implemented 3DES yourself) then that’s probably where your mistake is. Always leave the implementation of cryptosystems to academic professionals.
I’m going to assume you correctly set the keys and IV, which leaves the cipher block mode – which is the most plausible explanation as different platforms have their own defaults.
However, if you’ve verified that all of those things are the same in both your .NET and Java implementation, then you should repost your question but with more details, including relevant source code.