Reputation: 129
I have developed an application in which I have used the Cryptography with the help of BountyCastle.jar. I also had a line Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
Everything works fine when I execute the program from Netbeans
But when I packaging the application in an executable jar which internally uses BouncyCastle jar and execute the jar,
I am getting exception
JCE cannot authenticate the provider BC java.lang.SecurityException: JCE cannot authenticate the provider BC
Is there any other approch to implement the same. Because it is difficult for non technical person to add BountyCastle.jar in ext folder of jre. so is there any other method to solve my problem.
Is there any method to exclude BountyCastle.jar while packaging jar in netbeans so that will accessible from external lib folder.
Upvotes: 5
Views: 21763
Reputation: 1815
Don't add the class to your fat/assembly jar created by mvn/sbt. Make it provided. Download the jars from the official web page and add the jar separately to classpath of your program.
Upvotes: 1
Reputation: 11322
The BouncyCastle jar
archive is signed by BouncyCastle to prevent unauthorized changes. It needs the JCA
signature in order to be trusted as a cryptography provider, so do not remove it.
See a related post
Upvotes: 3