No such algorithm: SM4/ECB/PKCS5Padding
import java.security.Provider;
import java.security.Security;
public class CheckAlgorithmExistence {
public static void main(String[] args) {
Provider[] providers = Security.getProviders();
boolean algorithmExists = false;
for (Provider provider : providers) {
if (provider.getName().equals("BC")) {
algorithmExists = true;
break;
}
}
if (algorithmExists) {
System.out.println("指定的加密算法存在!");
} else {
System.out.println("指定的加密算法不存在!");
}
}
}