No such algorithm: SM4/ECB/PKCS5Padding

时间:2025-01-19 10:24:59
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("指定的加密算法不存在!"); } } }