I am new here, I am not new to programming, but am kinda new to encryption.
Great work with the Bouncy Castle (BC), however I have run into a major problem.
I have a server in C#, and the client in J2ME.
They are using Rijndael Encryption, and I am using the initialization vector.
The server is using the built in .NET encryption.
For the client, I am using eclipse, and the emulator is the S60 SDK, and sun wtk also works fine.
I can encrypt/decrpyt data fine on both client and server, when running the emulators.
However, when I put the J2ME app on my Nokia phone and run it over the internet or over bluetooth, then after several packets are sent, the server suddenly starts complaining:
"System.Security.Cryptography.CryptographicException: Padding is invalid and cannot be removed"
After the server gets that error, none of the data from the client can be successfully decrypted again. If I log out of the client app, it still gives the same error. I basically have to restart the app.
Any ideas please? I am stumped about this.
Joined: Sep 23, 2011
I did some more debugging last night which led me to think it's a bug in the BouncyCastle code somewhere.
What I did, was run the server and client normally, until the server is unable to "remove padding"
Then, I ran a custom function, on the client, that encrypts and decrypts data, using byte arrays of fixed key, iv, and input data.
The function works the fine before the client gets stuck, but after it gets stuck, I get this error when decrypting: InvalidCipherTextException: pad block corrupted
We don't have many rules here at the JavaRanch, but we do insist that you use your Real Name and not some sort of "handle" or obvious alias. If you're not sure about this, see http://www.javaranch.com/name.jsp .
Customer surveys are for companies who didn't pay proper attention to begin with.