JCE不能在java swing应用程序中验证提供者BC [英] JCE cannot authenticate the provider BC in java swing application
问题描述
javax.crypto.KeyGenerator.getInstance(AES,BC)给出例外:
java。 security.NoSuchProviderException:JCE无法验证javax.crypto.SunJCE_b.a(DashoA13 * ..)
的提供程序BC
javax.crypto.KeyGenerator.getInstance(DashoA13 * ..)
那么问题是什么?
要扩展GregS的注释,所有JCE提供者JAR必须先签名,才能被Java运行时信任。
BouncyCastle忠实地提供了签名JAR将无故障地工作。但是,如果您从此JAR中提取类文件,或重新编译源代码,则会删除该签名并导致Java拒绝代码。
看到这个相关的SO问题: 如何签署自定义JCE安全提供程序
I am creating a swing based application in JAVA which uses some encryption technique. But javax.crypto.KeyGenerator.getInstance("AES", "BC") gives exception:
java.security.NoSuchProviderException: JCE cannot authenticate the provider BC
at javax.crypto.SunJCE_b.a(DashoA13*..)
at javax.crypto.KeyGenerator.getInstance(DashoA13*..)
So what is the problem?
To expand on the comment from GregS, all JCE provider JARs must be signed before they will be trusted by your Java runtime.
BouncyCastle dutifully supplies signed JARs that will work without a problem. However, if you extract class files from this JAR, or recompile the source, it will remove the signature and cause Java to reject the code.
See this related SO question: How to sign a custom JCE security provider
这篇关于JCE不能在java swing应用程序中验证提供者BC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!