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

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

问题描述

我正在用 Java 创建一个基于 Swing 的应用程序,它使用了一些加密技术.但javax.crypto.KeyGenerator.getInstance("AES", "BC") 给出异常:

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*..)

那么问题出在哪里?

推荐答案

为了扩展来自 GregS 的评论,所有 JCE 提供程序 JAR 必须经过签名才能被您的 Java 运行时信任.

To expand on the comment from GregS, all JCE provider JARs must be signed before they will be trusted by your Java runtime.

BouncyCastle 尽职尽责地提供已签名的 JAR,这些 JAR 可以正常运行.但是,如果您从此 JAR 中提取类文件,或重新编译源代码,则会删除签名并导致 Java 拒绝代码.

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.

请参阅此相关 SO 问题:如何签署自定义 JCE 安全性提供者

See this related SO question: How to sign a custom JCE security provider

这篇关于JCE 无法在 java swing 应用程序中验证提供者 BC的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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