• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem in adding Bouncy Castle library to Project

 
Tarun Khandelwal
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

I am doing development in an embedded project and i am using Bouncy Castle for AES Encryption.
Now when i am adding Bouncy Castle as Security Provider, i am getting error in initializing the Cipher.
This is happening when i deploy my project on device.
When i am running my code in eclipse its working fine.
When i investigated further, i found that while deploying i am extracting the jar provided by the BC.
So code is not getting correct signature.

So can anyone can tell me how to use Bouncy Castle jar library in embedded device as i cannot access root of the device and add that to Class Path.

library i am using is jce-jdk13-146.jar and i am using Java JDK 1.3.

Please find the code inline



It would be Great to have a solution as soon as possible.
 
Tim Moores
Bartender
Posts: 2747
38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can add the BC classes in the same way you'd add your own classes. I *think* (not quite sure) that it would be OK if they are loaded by the same classloader. You'd then need to call "Security.addProvider(new BouncyCastleProvider());"

It goes without saying that you should run, not walk, to replace Java 1.3 with Java 6.
 
Tarun Khandelwal
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Tim,

Thanks for your reply.
I didn't got you. Are you saying that i should all the BC classes at run time that are being used by my code?
Adding Bouncy Castle will do the task?

Can you provide with a code snippet.
It would be great.

And i have constraint to JDK version.
As device on which i am working is having that version only.

Thanks and Regards,
Tarun Khandelwal
 
Tim Moores
Bartender
Posts: 2747
38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nothing gets installed at runtime. You can install BC along with your application. It's just Java class files (or a jar file), after all.

What code snippet? This is an installation issue. And I already posted the code you need to set BC as the security provider.
 
Tarun Khandelwal
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for your response. But i am not getting how to add a jar file as dependency to class path of the device.
And if i am extracting the jar its signature is lost and than i could not use its class files.


Thanks and Regards,
Tarun Khandelwal
 
Tim Moores
Bartender
Posts: 2747
38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
We still don't know what "the device" is, but I'd guess that its developer documentation covers that.
 
Tarun Khandelwal
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Everyone,

I have the solution to add jar files to my project. But Now when i am adding the Bouncy Castle Library :- jce-jdk13-146.jar, i am getting an error :-
.

Can anyone tell me why this issue is coming as now am using the jar itself.
Now what i am doing is,


classes folder :- myClasses
BC lib lib/jce-jdk13-146.jar

Now i am creating a jar for both, setting Classpath as lib in Manifest file.

So Final Structure is myJar.jar
myClasses
lib
jce-jdk13-146.jar
META-INF
Manifest.MF
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic