System.err.println("生成1个128bit的加密key:"+key); //原文 String str = "hello"; System.err.println("原文:"+str); StopWatch sw = StopWatch.create("q11"); sw.start(); SM4 sm41 = SmUtil.sm4(key.getBytes()); //加密为Hex String hexPass = sm41.encryptHex(str); System.err.prin...
密钥长度设置为其他值,则报异常:SM4 requires a 128 bit key * * @param keySize * @return * @throws NoSuchAlgorithmException * @throws NoSuchProviderException */ public static byte[] generateKey(int keySize) throws NoSuchAlgorithmException, NoSuchProviderException { KeyGenerator kg = KeyGenerator.ge...