1、加密代码如下
public static String encryptAEs_CBC(String data,String key,byte[] iv) {Cipher cipher = null;try {cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");//位数不够,自动补一个长度int blocksize = cipher.getBlockSize();byte[] dataBytes = data.getBytes();int dataLength = dataBytes.length;if (dataLength % blocksize != 0) {dataLength = dataLength + (blocksize - (dataLength % blocksize));byte[] plaintext = new byte[dataLength];System.arraycopy(dataBytes, 0, plaintext, 0, dataBytes.length);SecretKeySpec secretKey = new SecretKeySpec(key.getBytes(), &#