Java.security.NoSuchProviderException: no such provider: BC

I am using AdvancedInstaller 9.8 to create my javacode (webapplication) for the installer. My application usually works fine. After creating my installer using Advanced Installer 9.8, the installer is about 55 MB in size. But in the advanced installer there is an option to compress all the cans created for installation. If I compress the cans, the installer size is about 16 MB. But when I compress using Advanced Installer 9.8, I get an exception (as indicated in the header) when executing the line KeyPairGenerator kpg = KeyPairGenerator.getInstance ("RSA", "BC") ; in my code. Again KeyPairGenerator from java.security package. *;

Can someone please let me know what could be causing this problem. I know that when compressing with AdvancedInstaller, there may be a problem with Advanced Installer compression. But my question is what can usually be a problem on the Java side to get this problem. (I mean, what could be the reason, since any file could be damaged (or), etc. any other reasons) so that I can start working from there.

+7
source share
5 answers

Add this line before the code:

Security.addProvider(new BouncyCastleProvider()); 
+21
source

It has been fixed by replacing the latest bcprov-jdk15-.jar. My previous version is bcprov-jdk15-135.jar, and it created the problem as mentioned above.

+3
source

Along with checking your jre configuration you will need to check

1.Check that the java house is installed in the configuration

2.Check which java environment is used for the application

3.Check that \ jre \ lib \ security \ java.security has a bouncycastle provider entry. i.e. security.provider.9 = org.bouncycastle.jce.provider.BouncyCastleProvider

4. Also make sure that the jar box lock is added to jquery \ lib \ ext \ bcprov-jdk15on-147.jar (the last one works for java 1.5 and 1.6

+3
source

You can add a security provider by editing java.security with the following code to create a static block:

 static { Security.addProvider(new BouncyCastleProvider()); } 

If you are using a maven project, you will have to add a dependency for the BouncyCastleProvider, as shown in the pom.xml file of your project.

 <dependency> <groupId>org.bouncycastle</groupId> <artifactId>bcprov-jdk15on</artifactId> <version>1.47</version> </dependency> 

If you are using a regular java project, you can add the bcprov-jdk15on-147.jar download from the link below and edit your class path.

http://www.java2s.com/Code/Jar/b/Downloadbcprovextjdk15on147jar.htm

+2
source

The problem can be solved by importing the following parameters:

 import org.bouncycastle.jce.provider.BouncyCastleProvider; 

Then enter the code below into your class:

 Security.addProvider(new BouncyCastleProvider()); 
+2
source

All Articles