RSA/NONE/PKCS1Padding 给出错误为 java.security.NoSuchAlgorithmException

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20961481/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-13 05:35:12  来源:igfitidea点击:

RSA/NONE/PKCS1Padding giving error as java.security.NoSuchAlgorithmException

javaencryptionrsa

提问by artofabhishek

I am using "RSA/None/PKCS1Padding" as :

我使用“RSA/None/PKCS1Padding”作为:

Cipher RSACipher = Cipher.getInstance("RSA/None/PKCS1Padding");

Cipher RSACipher = Cipher.getInstance("RSA/None/PKCS1Padding");

This gives me exception as :

这给了我一个例外:

java.security.NoSuchAlgorithmException: Cannot find any provider supporting RSA/None/PKCS1Padding

java.security.NoSuchAlgorithmException: Cannot find any provider supporting RSA/None/PKCS1Padding

Thanks for help.

感谢帮助。

回答by Maarten Bodewes

Try "RSA/ECB/PKCS1Padding"instead if you are running in an Oracle or Open JDK. It does not make too much sense to use a block cipher mode of encryption with RSA, but not all algorithm names are logical within the Java SE providers.

"RSA/ECB/PKCS1Padding"如果您在 Oracle 或 Open JDK 中运行,请尝试改用。对 RSA 使用分组密码加密模式没有太大意义,但并非所有算法名称在 Java SE 提供程序中都是合乎逻辑的。

The Bouncy Castle Libraries support "RSA/None/PKCS1Padding"though. So maybe the code was written for Bouncy or Android.

充气城堡图书馆"RSA/None/PKCS1Padding"虽然支持。所以也许代码是为 Bouncy 或 Android 编写的。