While I was upgrading my application to Java 8 with Wildfly as container I got stunned with following exception,


java.lang.SecurityException: JCE cannot authenticate the provider ...
[ERROR] at javax.crypto.Cipher.getInstance(Cipher.java:652)
[ERROR] at javax.crypto.Cipher.getInstance(Cipher.java:591)

.......

.......

<span style="font-size: 1rem;">ERROR] Caused by: java.lang.SecurityException: Cannot verify jar:vfs:/software/wildfly-10.1.0.Final/standalone/deployments/myapp.war/WEB-INF/lib/IngrianNAE.jar/</span>

[ERROR] at javax.crypto.JarVerifier.verifySingleJar(JarVerifier.java:407)
[ERROR] at javax.crypto.JarVerifier.verifyJars(JarVerifier.java:322)
[ERROR] at javax.crypto.JarVerifier.verify(JarVerifier.java:250)
[ERROR] at javax.crypto.JceSecurity.verifyProviderJar(JceSecurity.java:160)
[ERROR] at javax.crypto.JceSecurity.getVerificationResult(JceSecurity.java:186)
[ERROR] at javax.crypto.Cipher.getInstance(Cipher.java:648)
[ERROR] at javax.crypto.Cipher.getInstance(Cipher.java:591)

..............

..............

[ERROR] Caused by: java.security.PrivilegedActionException: java.util.zip.ZipException: zip file is empty
[ERROR] at java.security.AccessController.doPrivileged(Native Method)
[ERROR] at javax.crypto.JarVerifier.verifySingleJar(JarVerifier.java:385)
[ERROR] ... 49 more
[ERROR] Caused by: java.util.zip.ZipException: zip file is empty
[ERROR] at java.util.zip.ZipFile.open(Native Method)
[ERROR] at java.util.zip.ZipFile.<init>(ZipFile.java:220)

..............

..............

[ERROR] Suppressed: java.nio.file.NoSuchFileException: /tmp/jar_cache2489857927727974825.tmp
[ERROR] at sun.nio.fs.UnixException.translateToIOException(UnixException.java:86)
[ERROR] at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102)
[ERROR] at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107)

I got this resolved by adding following line in my jboss-deployment-structure.xml file.


<resources>
<resource-root path="WEB-INF/lib/IngrianNAE.jar" use-physical-code-source="true"/>
</resources>

After I restart my JVM I got following exception,

[ERROR] com.myapp.crypto.InternalEncryptionException: Illegal key size

To fix this, I downloaded JCE 8 policy JAR’s from http://www.oracle.com/technetwork/java/javase/downloads/jce8-download-2133166.html and copied them into my JRE security folder.

Leave a Reply

Your email address will not be published.

WP2Social Auto Publish Powered By : XYZScripts.com