简体   繁体   中英

How to solve the NoSuchAlgorithmException in java?

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

The error means that the library you use cna't decrypt the data because there isn't an algorithm in the Lib which decrypts RSA. You can use a library like Bouncy Calste or GNU Crypto to decrypt data using RSA. There are plenty of samples how to do this on the web.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM