JCE不能在java swing应用程序中验证提供者BC [英] JCE cannot authenticate the provider BC in java swing application

查看:543
本文介绍了JCE不能在java swing应用程序中验证提供者BC的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在JAVA中创建一个基于swing的应用程序,它使用一些加密技术。但是
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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆