`JCE cannot authenticate the provider BC` when running a JAR

冷暖自知 提交于 2019-12-22 10:45:17

问题


In my scala project I use "org.bouncycastle" % "bcprov-jdk14" % "1.51" for cryptography.
If it test my project in Scala IDE it works fine. But once I make a JAR and try to run it via java -jar ... it throws an exception: Exception in thread "main" java.lang.SecurityException: JCE cannot authenticate the provider BC

I use https://github.com/sbt/sbt-assembly for making a JAR and here's my java -version output:

java version "1.7.0_72"
Java(TM) SE Runtime Environment (build 1.7.0_72-b14)
Java HotSpot(TM) Server VM (build 24.72-b04, mixed mode)

When making a JAR I see this output:

[info] Merging files...
[warn] Merging 'META-INF/BCKEY.DSA' with strategy 'discard'
[warn] Merging 'META-INF/BCKEY.SF' with strategy 'discard'
[warn] Merging 'META-INF/LAMBDAWO.SF' with strategy 'discard'
[warn] Merging 'META-INF/MANIFEST.MF' with strategy 'discard'
[warn] Merging 'reference.conf' with strategy 'concat'
[warn] Merging 'rootdoc.txt' with strategy 'concat'
[warn] Strategy 'concat' was applied to 2 files
[warn] Strategy 'discard' was applied to 4 files

How can I fix this issue?

来源:https://stackoverflow.com/questions/27168951/jce-cannot-authenticate-the-provider-bc-when-running-a-jar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!