| | |
| | | * @throws Exception |
| | | */ |
| | | private static byte[] aesEncryptToBytes(String content, String encryptKey) throws Exception { |
| | | //KeyGenerator kGen = KeyGenerator.getInstance(KEY_ALGORITHM); |
| | | //kGen.init(128); |
| | | // KeyGenerator kGen = KeyGenerator.getInstance(KEY_ALGORITHM) |
| | | // kGen.init(128) |
| | | |
| | | Cipher cipher = Cipher.getInstance(ALGORITHMSTR); |
| | | cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(encryptKey.getBytes(), KEY_ALGORITHM)); |
| | |
| | | * @throws Exception |
| | | */ |
| | | private static String aesDecryptByBytes(byte[] encryptBytes, String decryptKey) throws Exception { |
| | | //KeyGenerator kGen = KeyGenerator.getInstance(KEY_ALGORITHM); |
| | | //kGen.init(128); |
| | | // KeyGenerator kGen = KeyGenerator.getInstance(KEY_ALGORITHM) |
| | | // kGen.init(128) |
| | | |
| | | Cipher cipher = Cipher.getInstance(ALGORITHMSTR); |
| | | cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(decryptKey.getBytes(), KEY_ALGORITHM)); |