jce cannot authenticate the provider bc
Asked Answered
E

2

5

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.

Ennoble answered 25/9, 2015 at 5:35 Comment(4)
Just checking: have you asked on the BC mailing list? They take this kind of question all the time. You could probably find the answer there, then come back and post it here for others to find.Scleroprotein
@Scleroprotein thanks for reply. but i am not aware of BC mailing list. can you please share a link for same. it will easy for me to post my queryEnnoble
The page for the BC Java mailing lists is bouncycastle.org/mailing_lists.html. It has subscription instructions and a searchable archive. You want the dev-crypto list.Scleroprotein
Possible duplicate of JCE cannot authenticate the provider BC in java swing applicationDramatization
L
3

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

Lunge answered 25/9, 2015 at 15:59 Comment(2)
same applies to the rule of not adding it to an assembly or a fat jar!Thenceforth
@Thenceforth -- do tell more about not adding it to a fat jar. I am having problems after adding it there.Clothespress
T
1

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.

Thenceforth answered 17/5, 2017 at 8:56 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.