Bouncy城​​堡中具有SHA256的ECDSA不会引发此类算法异常 [英] ECDSA with SHA256 in Bouncy castle throws No Such Algorithm Exception

查看:112
本文介绍了Bouncy城​​堡中具有SHA256的ECDSA不会引发此类算法异常的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正尝试使用 ECDSA Bouncy Castle 中的 SHA256 生成签名,如下所示,

I am trying to generate a signature using ECDSA with SHA256 in Bouncy Castle as follows,

  1. 我在开头添加了提供程序
  2. 我已经构建了ECPrivatekey
Signature s_oSignature = Signature.getInstance("SHA256withECDSA",     
BouncyCastleProvider.PROVIDER_NAME);

但是步骤3抛出"java.security.NoSuchAlgorithmException:没有这样的算法:提供者BC的SHA256withECDSA" .

但是,当用"SHA1withECDSA" 替换时,同样的"SHA256withECDSA" 东西毫无例外.

But same "SHA256withECDSA" thing when replaced with "SHA1withECDSA" prceeds without any exception.

怎么可能?我正在使用"bcprov-jdk14-121.jar" .

How is it possible? I am using "bcprov-jdk14-121.jar".

我已经苦苦挣扎很长时间了,有人可以帮我吗?

Can any one please help me as I have been struggling for a long time?

推荐答案

我从未遇到过此问题,但是您可以尝试以下一些操作.

I've never encountered this problem but here are a few things you can try.

  1. 确保已安装并配置了Java密码学扩展(JCE)无限强度管辖权策略文件(下载此处在页面底部)
  2. 尝试使用最新版本的BouncyCastle ,并将其作为提供程序安装在运行时中,并不在计划内进行中
  1. make sure you have the Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy Files installed and configured (download here at the bottom of the page)
  2. try using the latest release of BouncyCastle and installing it as a provider in the runtime and not on-the-fly within the program

这个问题非常奇怪,因为SHA256withECDSA明确列在规格中,因此无论有多大的帮助可能性,它都只能尝试所有可能的选择.

This problem is extremely odd as SHA256withECDSA is clearly listed in the specifications so it only leaves the option to try all possible options no matter how unlikely they are to help.

这篇关于Bouncy城​​堡中具有SHA256的ECDSA不会引发此类算法异常的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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