Hi, I want to know which padding modes for AES encryption are common in both java and C#.NET
Thanks Bapi
Hi, I want to know which padding modes for AES encryption are common in both java and C#.NET
Thanks Bapi
A couple padding algorithms are outlined at Wikipedia. I have seen PKCS7 used in some significant applications (the Oracle client, for example). It's dead simple to implement, so you wouldn't have to worry if either platform does not support it out of the box.
None, PKCS7, Zeros
Dotnet supports these 3 as do all the JCE providers.
If you're looking for java<->.net AES I would recommend Bouncy Castle, they have libs for both free.
I was working on a class project and figured out a few details the hard way. First, Java supports PKCS7 padding out of the box but under a different name. It's called PKCS5. Some programmers use Bouncy Castle because of the mistaken belief that Java does not support PKCS7, but supports a different (older) padding type. This shouldn't really matter, except that Bouncy Castle turned out to have terrible bugs. My project relied on their implementation of AES. While it works if you encrypt all the data at once with a single doFinal, encrypting blocks goes horribly wrong and the outcome even changes depending on the buffer size used to pass the data. Switching back to Sun's implementation gave the correct results with the same code. Needless to say, that costed us a few days of debugging.