PHP版本
JAVA
private static final String keys = "676366bwl7656bwA"; //密钥
private static final String iv = "bwl354334bwl7754"; //偏移量
/**
* AES加密
* @param data 需要加密的数据
* @return
*/
public static String encrypt( String data) {
byte[] encrypted = {};
byte[] enCodeFormat = keys.getBytes();
SecretKeySpec secretKeySpec = new SecretKeySpec(enCodeFormat,"AES");
try {
Cipher cipher = Cipher.getInstance("AES/CBC/NoPadding");
cipher.init(Cipher.ENCRYPT_MODE,secretKeySpec,new IvParameterSpec(iv.getBytes()));
int blockSize = cipher.getBlockSize();
System.out.println(data.length());
byte[] dataBytes = data.getBytes();
int plaintextLength = dataBytes.length;
if (plaintextLength % blockSize !=