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.
The problem can be resolved by importing the following:
Then put the below code in your class method:
You can add security provider by editing java.security with using following code with creating static block:
If you are using maven project, then you will have to add dependency for BouncyCastleProvider as follows in pom.xml file of your project.
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
Add this line before your code:
Along with checking jre configuration you will need to check
1.Check that the java home is set in the configuration
2.Check which java environment is used for application
3.Check that \jre\lib\security\java.security has bouncycastle provider entry. i.e. security.provider.9=org.bouncycastle.jce.provider.BouncyCastleProvider
4.Also check that bouncy castle jar is added to \jre\lib\ext\ bcprov-jdk15on-147.jar (latest one to work for java 1.5 & 1.6
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.