How do I obfuscate DLLs in .apk generated by Xamarin?

I need to confuse my code as part of company policy. I use MSBuild to automate the process with this:

<Exec Command="$(MsBuildPath) /p:Configuration=Release /t:Rebuild;SignAndroidPackage &quot;$(CodeRootPath)\Mfx.UI.Droid\Mfx.UI.Droid.csproj&quot; > &quot;$(OutputPath)\3_BuildApkLog.txt&quot;" />

- the corresponding line that creates the solution and creates apk. I have obfuscation in the event after the build:

COPY $(TargetDir)*.* $(TargetDir)..\..\..\..\Obfuscation\workbench "C:\Program Files (x86)\MSBuild\14.0\Bin\msbuild.exe" "$(TargetDir)..\..\..\..\Obfuscation\Capture.babel"

which copies the output of the assembly folder to another folder and calls my babel project, which outputs the obfuscation of the DLL to the original assembly folder. After completing my batch file, the dlls in bin \ Release \ are all confused, but when I decompile the apk, the dlls inside are not confused.

Is there a way to obfuscate DLLs after creating an APK, or is there a better time for obfuscation?

+4
source share
1 answer

In addition to using an obfuscator, you can:

  • Use the AOT compilation for Android, where IL code is removed and replaced with native code, and only metadata is saved. It is much more difficult to decompile.

  • Embed assemblies in Native Code, which makes it difficult to access IL.

+2
source

Source: https://habr.com/ru/post/1671981/


All Articles