java jce 无法验证提供者 bc
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/32775478/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
jce cannot authenticate the provider bc
提问by NULL Pointer
I have developed an application in which I have used the Cryptography with the help of BountyCastle.jar. I also had a line Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
我开发了一个应用程序,其中我在 BountyCastle.jar 的帮助下使用了密码学。我也有一行 Security.addProvider(new org.bouncycastle.jce.provider.BouncyCastleProvider());
Everything works fine when I execute the program from Netbeans
当我从 Netbeans 执行程序时一切正常
But when I packaging the application in an executable jar which internally uses BouncyCastle jar and execute the jar,
但是当我将应用程序打包在一个内部使用 BouncyCastle jar 并执行该 jar 的可执行 jar 中时,
I am getting exception
我得到了例外
JCE cannot authenticate the provider BC java.lang.SecurityException: JCE cannot authenticate the provider BC
JCE 无法验证提供者 BC java.lang.SecurityException: JCE 无法验证提供者 BC
Is there any other approch to implement the same. Because it is difficult for non technical person to add BountyCastle.jar in ext folder of jre. so is there any other method to solve my problem.
有没有其他方法来实现相同的。因为非技术人员很难在 jre 的 ext 文件夹中添加 BountyCastle.jar。那么有没有其他方法可以解决我的问题。
Is there any method to exclude BountyCastle.jar while packaging jar in netbeans so that will accessible from external lib folder.
是否有任何方法可以在将 jar 打包到 netbeans 中时排除 BountyCastle.jar,以便可以从外部 lib 文件夹访问。
回答by Axel Kemper
The BouncyCastlejar
archive is signed by BouncyCastleto prevent unauthorized changes. It needs the JCA
signature in order to be trusted as a cryptography provider, so do not remove it.
该BouncyCastle的jar
档案被签署BouncyCastle的,以防止未经授权的更改。它需要JCA
签名才能被信任为密码学提供者,所以不要删除它。
See a related post
查看相关帖子
回答by Dragonborn
Don't add the class to your fat/assembly jar created by mvn/sbt. Make it provided. Download the jars from the official web page and add the jar separately to classpath of your program.
不要将类添加到由 mvn/sbt 创建的 fat/assembly jar。让它提供。从官网下载jar包,单独添加到你程序的classpath中。