`JCE在运行JAR时无法验证提供程序BC`

时间:2014-11-27 10:57:49

标签: java scala jar bouncycastle

在我的scala项目中,我使用"org.bouncycastle" % "bcprov-jdk14" % "1.51"进行加密 如果它在Scala IDE中测试我的项目,它可以正常工作。但是,一旦我创建了一个JAR并尝试通过java -jar ...运行它,就会引发异常:Exception in thread "main" java.lang.SecurityException: JCE cannot authenticate the provider BC

我使用https://github.com/sbt/sbt-assembly制作JAR,这是我的java -version输出:

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)

制作JAR时,我看到了这个输出:

[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

如何解决此问题?

0 个答案:

没有答案