| 57 | } |
| 58 | |
| 59 | private static String cbc(String data) throws Exception { |
| 60 | String decode = new String(Util.hex2byte(data)).toLowerCase(); |
| 61 | String key = padEnd(decode.substring(decode.indexOf("$#") + 2, decode.indexOf("#$"))); |
| 62 | String iv = padEnd(decode.substring(decode.length() - 13)); |
| 63 | SecretKeySpec keySpec = new SecretKeySpec(key.getBytes(), "AES"); |
| 64 | IvParameterSpec ivSpec = new IvParameterSpec(iv.getBytes()); |
| 65 | Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding"); |
| 66 | cipher.init(Cipher.DECRYPT_MODE, keySpec, ivSpec); |
| 67 | data = data.substring(data.indexOf("2324") + 4, data.length() - 26); |
| 68 | byte[] decryptData = cipher.doFinal(Util.hex2byte(data)); |
| 69 | return new String(decryptData, StandardCharsets.UTF_8); |
| 70 | } |
| 71 | |
| 72 | private static String base64(String data) { |
| 73 | String extract = extract(data); |