code: private static String aesEncrypt(String content, String aesKey, String charset)
                                                                                     throws AlipayApiException {
  
          try {
              Cipher cipher = Cipher.getInstance(AES_CBC_PCK_ALG);
  
              IvParameterSpec iv = new IvParameterSpec(AES_IV);
              cipher.init(Cipher.ENCRYPT_MODE,
                  new SecretKeySpec(Base64.decodeBase64(aesKey.getBytes()), AES_ALG), iv);
  
              byte[] encryptBytes = cipher.doFinal(content.getBytes(charset));
              return new String(Base64.encodeBase64(encryptBytes));
          } catch (Exception e) {
              throw new AlipayApiException("AES加密失败：Aescontent = " + content + "; charset = "
                                           + charset, e);
          }
  
      }
docs: AES加密
  
  @param content
  @param aesKey
  @param charset
  @return
  @throws AlipayApiException