I am using AdvancedInstaller 9.8 to build my javacode (webapplication) to an installer. Normally my application is running fine. After creating my installer with Advanced Installer 9.8, the installer size is around 55 MB. But there is an option in advanced installer to compress all the jars made for the installation. If i compress the jars, the installer size is around 16 MB. But when I compress with Advanced Installer 9.8, I am getting the exception (as mentioned in the title) when executing the line KeyPairGenerator kpg = KeyPairGenerator.getInstance("RSA", "BC"); in my code. Again the KeyPairGenerator is from the package java.security.*;
Could anybody please let me know, what could be the cause of this issue. I know when compressing with AdvancedInstaller, it could be some issue with the Advanced Installer compressing. But my question is what could be normally the issue on java side, to get that issue. ( i mean what could be the reason, like any file can be corrupted (or) etc any other reasons) so that I can start working from there.
Add this line before your code:
Security.addProvider(new BouncyCastleProvider());
You can add security provider by editing java.security with using following code with creating static block:
static {
Security.addProvider(new BouncyCastleProvider());
}
If you are using maven project, then you will have to add dependency for BouncyCastleProvider as follows in pom.xml file of your project.
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk15on</artifactId>
<version>1.47</version>
</dependency>
If you are using normal java project, then you can add download bcprov-jdk15on-147.jar from the link given below and edit your classpath.
http://www.java2s.com/Code/Jar/b/Downloadbcprovextjdk15on147jar.htm
It got fixed by replacing the latest bcprov-jdk15-.jar. My previous version is bcprov-jdk15-135.jar and it created the problem as mentioned above.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With