2

How to write a BlackBerry program for AES/CBC with Initialization Parameter ecncryption and Decryption and this encryption and decryption should work independent on Programming language Ex= If I encrypt some data using BlackBery I must be able to decrypt the same data using Java Program.

Thanks Deepak

Sunil Kumar Sahoo
  • 53,011
  • 55
  • 178
  • 243

4 Answers4

1

Have you read this KB article? http://www.blackberry.com/knowledgecenterpublic/livelink.exe/fetch/2000/348583/800332/800779/How_to_-_Use_Basic_Encryption.html?nodeid=800640&vernum=0

You will also need to use net.rim.device.api.crypto.CBCEncryptorEngine on top of the AESEncryptorEngine (and similar for decryption).

Richard
  • 8,920
  • 2
  • 18
  • 24
1

The decryption half of your question is answered here: decrypting data with AES/CBC/PKCS5Padding using blackberry

It should be easy to figure out encryption using the same pattern (use Encryptor instead of Decryptor engines, etc).

Community
  • 1
  • 1
Anthony Rizk
  • 3,666
  • 20
  • 21
  • The link tells to use bouncy castle. Its an external jar we can not use external jar. So is there any other way to achieve this. – Sunil Kumar Sahoo May 27 '09 at 15:40
  • My answer to that question is about the BlackBerry API - sorry, I can see where that wasn't clear, I edited the first sentence to hopefully make it clearer. – Anthony Rizk May 28 '09 at 20:05
  • Hi Anthony, I tried in the way you have mentioned. But I can encrypt or decrypt upto 16 bytes means 128 bits. So If I increase the block size then i am getting error because of CBC. I have inserted block size as multiple of 16. – iOSDev May 29 '09 at 12:14
0

CBCEngine allows you upto 16 bytes for across platform. so donot use CBC. try to use the default supported cipher engine.

I think ECB will be great if you use.

Thanks Sunil Kumar sahoo

Sunil Kumar Sahoo
  • 53,011
  • 55
  • 178
  • 243
0

Actually, you write your own code for AES algorithm and CBC mode, it is quite simple, around some hundreds of code lines. And, there should be reference implementation in Java language.

Nickolay Olshevsky
  • 13,706
  • 1
  • 34
  • 48