简体   繁体   中英

java.security.NoSuchAlgorithmException: AES/ECB/PKCS5Padding

I am developing an android application in which it is necessary to decrypt the file. I specify an algorithm as follows:

Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding", "Crypto");

But get the error:

java.security.NoSuchAlgorithmException: AES/ECB/PKCS5Padding

What is my mistake?

Thanks.

Try and use

 Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");

If you don't specify the provider, it will look for the highest prioritized provider that does implement it.

Define the exception handler. You need to add the proper import in the begging of your class, like this:

import java.security.NoSuchAlgorithmException;
import javax.crypto.NoSuchPaddingException;
import javax.crypto.Cipher; 

Look here how

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