如何解决java中的NoSuchAlgorithmException? [英] How to solve the NoSuchAlgorithmException in java?

查看:339
本文介绍了如何解决java中的NoSuchAlgorithmException?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用RSA算法解密数据。在做解密时,我得到一个例外。那是

  java.security.NoSuchAlgorithmException:找不到任何支持RSA的提供者/ ECB / PKCS5Padding 
在javax.crypto.Cipher.getInstance(DashoA13 * ..)

如何解决这个异常?目前,我正在使用 java版本1.6.0_26

解决方案

这是一个错字。使用PKCS#1 v1.5填充的RSA的正确名称为RSA / ECB / PKCS1Padding。
通常,与可用算法列表进行比较是个好主意。
例如此问题包含打印此类列表的一些方法。 / p>

(当然,使用OAEP而不是v1.5填充将是更可取的,特别是如果您的
主字段不是加密)。


I am trying to decrypt the data using RSA Algorithm. While doing the decryption, I am getting an exception.That is,

java.security.NoSuchAlgorithmException: Cannot find any provider supporting RSA/ECB/PKCS5Padding
        at javax.crypto.Cipher.getInstance(DashoA13*..)

How to solve this exception? Currently, I am using java version "1.6.0_26".

解决方案

It's a typo. The correct name for RSA with PKCS #1 v1.5 padding is "RSA/ECB/PKCS1Padding". Generally, it is a good idea to compare with a list of available algorithms. E.g. this question contains some ways to print such a list.

(And of course using OAEP instead of v1.5 padding would be preferable, especially if your main field is not cryptography).

这篇关于如何解决java中的NoSuchAlgorithmException?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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