aes linux下报错

KeyGenerator keyGen = KeyGenerator.getInstance("AES");
SecureRandom random=SecureRandom.getInstance("SHA1PRNG");
random.setSeed(decryptKey.getBytes());
keyGen.init(128, random);

Cipher cipher = Cipher.getInstance("AES");
cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(keyGen.generateKey().getEncoded(), "AES"));
byte[] decryptBytes = cipher.doFinal(encryptBytes);

return new String(decryptBytes);

修改生成key的方法

你可能感兴趣的:(aes linux下报错)