DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Related

  • Cross-Platform Mobile Application Development: Evaluating Flutter, React Native, HTML5, Xamarin, and Other Frameworks
  • How To Build a Financial App With Proactive Security Measures
  • Top 13 Mobile App Development Platforms You Need
  • Xamarin vs React Native: Which One Wins The Race?

Trending

  • A System Cannot Protect What It Does Not Understand
  • Detecting Plan Regression in SQL Server Using Query Store
  • Testing AI-Infused Apps: A Dual-Layer Framework for AI Quality Assurance
  • Beyond Manual Annotation: Engineering Self-Correcting Pseudo-Labeling Pipelines
  1. DZone
  2. Coding
  3. Frameworks
  4. Safeguard Your Xamarin Apps From Threats With Dotfuscator

Safeguard Your Xamarin Apps From Threats With Dotfuscator

We take a look at how mobile application developers working with Xamarin can secure their apps with this free, and awesome, tool.

By 
Kaushal Shah user avatar
Kaushal Shah
·
Updated Aug. 13, 22 · Tutorial
Likes (3)
Comment
Save
Tweet
Share
7.1K Views

Join the DZone community and get the full member experience.

Join For Free

To do this, we will use PreEmptive Protection – Dotfuscator, an obfuscator, and protection tool that now also supports Xamarin. You will, of course, need your app to be developed using Visual Studio 2017 for Windows.

Protection from Cyber Threats is Worthwhile

There are many people who do not realize how much danger they are in when it comes to outside cyber threats. They are worried that there are larger forces in action that may cause them to lose some of the precious data that they have worked so hard to build up, and they are not wrong about this. 

If you have apps created with Xamarin, you need to protect them with Dotfuscator. There is simply no excuse not to keep your information under a tight lock and key these days, and you are strongly encouraged to act rapidly so you don’t end up in a situation where you are unable to access the precious data that you know you need to keep safe. Too many people have allowed the data out into the wild, and you simply CANNOT follow in those footsteps.

Image title


Step 1: Install and Set Up Dotfuscator

You will need to set up Dotfuscator on your machine, register your copy, and record the path to the command line interface.

Here’s how to set it up:

  1. Use the PreEmptive Solutions website and navigate to the Dotfuscator Downloads page.

  2. From here download the latest release of Dotfuscator Community Edition (CE) for Visual Studio 2017.

  3. Now run the VSIX file that you have downloaded and follow the set-up instructions.

  4. Next launch Visual Studio 2017 and go to Tools – PreEmptive Protection – Dotfuscator to start the Dotfuscator CE user interface. As explained earlier, your copy of Dotfuscator must be registered before you can use it. You will be prompted by Dotfuscator to log in when you use it for the first time. You will need to register your copy of Dotfuscator before you can use the command line interface. Dotfuscator will ask you to register when you run it for the first time; follow these instructions.

  5. If you want to register later or find out your registration status, check the registration status text in the upper-right corner of the Dotfuscator webpage.

  6. The path to CLI is required to configure the build integration. You can find this path by navigating to the install directory for your installation of Visual Studio 2017. For example, the default install directory for Visual Studio 2017 Professional is: C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional. Inside this directory, find the Dotfuscator Community Edition extension files in *\Common7\IDE\Extensions\PreEmptiveSolutions\DotfuscatorCE. The dotfuscatorCLI.exe executable is the Dotfuscator Community Edition command line interface. Secure the absolute path to the executable for later use.

Step 2: Download the Build Integration File

The Dotfuscator team has created an MSBuild targets file to aid the integration process. This data can be referenced by your Xamarin projects. Download this here.

Now save the PreEmptive.Dotfuscator.Xamarin.Targets file to your application’s solution directory, adding it to your local source control.

Step 3: Editing the Project for Build Integration

To modify your project file for the Visual Studio project that you want to obfuscate:

  1. First, note the project build configurations that you want to guard. These are everything except Debug configurations. If you want more guidance on this, you can refer to the ‘Select What to Protect’ section of the documentation.

  2. Using a text editor, open your project file. For instance, a project file for C# would be `YourProjectName.csproj.'

  3. Make a note of the relative path from this file to the build integration file you have downloaded.

  4. Next, import the build integration file by adding the following command to the file, just before the </Project> tag: <Import Project="..\..\PreEmptive.Dotfuscator.Xamarin.targets" />. This will substitute the relative path that you had noted earlier, substituting the relative path noted in Step 3.

  5. Within the <PropertyGroup> tag and no Condition attribute, add the following tags:<DotfuscatorXamarinCliPath>C:\pathto\dotfuscatorCLI.exe</DotfuscatorXamarinCliPath>,replacing the absolute path to the Dotfuscator Community Edition CLI you had noted earlier:<DotfuscatorXamarinConfigFileName>DotfuscatorConfig.xml</DotfuscatorXamarinConfigFileName> and <DotfuscatorXamarinGenerateNewConfigFile>true</DotfuscatorXamarinGenerateNewConfigFile>.

  6. Similarly, for each build configuration noted previously, find the related <PropertyGroup> and add the following tag: <DotfuscatorXamarinEnabled>true</DotfuscatorXamarinEnabled>

  7. Once the last of the <ItemGroup> tags are added, add the following:<ItemGroup><None Include="DotfuscatorConfig.xml" /></ItemGroup>. Save your changes to the file and close it.

Step 4: Build the App

Finally, you can start building the app with Dotfuscator protection:

  1. Launch your project using Visual Studio 2017.

  2. Now choose the solution build configuration that exercises a project build configuration you want to protect.

  3. Build your project. Post the first build, ensure that the output shows the following lines regarding the Dotfuscator.

    Image title

  4. You will find the addition of a DotfuscatorConfig.XML file in your project. This data is the Dotfuscator config file, and it tells the program how to obfuscate the code. The recommended use is to check it into your source control.

  5. You will also see the new DotfuscatorReports directory in your project directory. This list contains the information about project obfuscation process including the details on reversing the process, and this information should be treated like build output and have the source control ignore it.

  6. Now you need to test the app, and if there are errors, further Dotfuscator configuration may be required to correct these mistakes.

  7. You can continue developing and building your app per usual. Whenever Dotfuscator is called in the build, the output will display the following:

    Image title

Summary

This post explains the benefits and procedures of obfuscating your apps using Dotfuscator. You can protect your Android, iOS, and UWP apps utilizing the process described here. If you need more information on protecting your Xamarin projects with the help of a Dotfuscator, visit the Xamarin Dotfuscator User Guide. If you have any other queries or comments, please use the feedback section below.

mobile app xamarin Build (game engine)

Opinions expressed by DZone contributors are their own.

Related

  • Cross-Platform Mobile Application Development: Evaluating Flutter, React Native, HTML5, Xamarin, and Other Frameworks
  • How To Build a Financial App With Proactive Security Measures
  • Top 13 Mobile App Development Platforms You Need
  • Xamarin vs React Native: Which One Wins The Race?

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

  • RSS
  • X
  • Facebook

ABOUT US

  • About DZone
  • Support and feedback
  • Community research

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 215
  • Nashville, TN 37211
  • [email protected]

Let's be friends:

  • RSS
  • X
  • Facebook