• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

BC works fine in simulator, but stops working after awhile on nokia phone?

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Greetings,

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.
 
Lonely Coder
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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

Please help!
 
Saloon Keeper
Posts: 27752
196
Android Eclipse IDE Tomcat Server Redhat Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"LonelyCoder",

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 .
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic