MCPcopy Create free account
hub / github.com/FongMi/TV / cbc

Method cbc

app/src/main/java/com/fongmi/android/tv/api/Decoder.java:59–70  ·  view source on GitHub ↗
(String data)

Source from the content-addressed store, hash-verified

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);

Callers 1

verifyMethod · 0.95

Calls 6

hex2byteMethod · 0.95
padEndMethod · 0.95
getInstanceMethod · 0.80
substringMethod · 0.45
indexOfMethod · 0.45
initMethod · 0.45

Tested by

no test coverage detected