Categories
Support Corner

Protecting .NET Applications that Use Excel Interop

Reading Time: 2 minutes

Microsoft Office primary interop assemblies give us the ability to create and modify Excel Spreadsheets from a .NET application.  Office applications like Excel are written in unmanaged code.  The primary interop assembly provides wrappers to call unmanaged COM objects from our managed .NET application. 

By default, when you reference an Office primary interop assembly, the interop types are embedded into your application to avoid having to deploy extra assemblies.  When applying protection, we must preserve some of these embedded types and methods to maintain COM interoperability.

Please consider the following example.  This simple C# application uses Excel Interop to create a spreadsheet and populate cells:

When applying for full protection with Dotfuscator, I experience a TypeLoadException at runtime:

To avoid this error, I will configure a rename exclusion for the embedded interop types.  All the embedded Interop types are in the Microsoft.Office.Interop.Excel namespace.  The specific types I need to preserve are interfaces, most of which contain placeholder methods of the form “_VtblGapX_XX” that also must be preserved.

Based on these patterns, I can leverage custom rules to simplify the Renaming configuration.  From my DotfuscatorConfig.xml:

After configuring this rule, the protected output runs properly, and my spreadsheet is created.

The above pattern is general enough to work if the Office primary interop assembly is used for creating any type of Office document: Excel spreadsheet, PowerPoint presentation, Word document, etc.

The full example can be downloaded here.

If you have any feedback on this topic or other topics you would like us to discuss in the Support Corner, please feel free to contact our Support Department.

Categories
Support Corner

Protecting Java Applications That Use Jackson for JSON

Reading Time: 3 minutes

SON is a standard format for sharing objects and data within an application. When working in Java, there is no built-in support for JSON processing. There are, however, several widely-used libraries and options to choose from. In this article, we will focus on Jackson, which is one of the most popular.

Categories
Support Corner

Protecting C# Applications That Use Automapper

Reading Time: 2 minutes

AutoMapper is an object-to-object mapping system used by many of our customers. It aims to simplify and organize code responsible for sharing instance values from an object of one type to an object of a different type.

Categories
Support Corner

Integrating DashO Into A Maven Build

Reading Time: 2 minutes

Maven is perhaps the most widely-used project management tool for Java. Based on the Project Object Model (POM), it is used not only for compilation of source code, but also dependency management, documentation, running tests, packaging, deployment, and more. We are frequently asked if we have a Maven plugin for running DashO. Though we do not offer a specific Maven plugin, adding DashO to your Maven-based project is surprisingly easy by leveraging Ant.

Categories
Support Corner

Protecting Localized Xamarin Forms Applications

Reading Time: 3 minutes

Localization is often a key ingredient when building Xamarin Forms applications with a global audience. There are different ways to approach app localization, but most of these leverage the built-in tools provided by the .NET Framework.

Categories
Support Corner

Protecting C# Applications That Use Dynamic Types

Reading Time: 3 minutes

The dynamic type in C# provides flexibility that is not available in other statically-typed languages. Since its introduction in C# 4.0 (.NET 4.5), we have worked with customers who wanted to know more about how dynamic types are impacted by the obfuscation process.

Categories
Support Corner

Protecting Java Android Applications that use Butter Knife

Reading Time: 3 minutes

Butter Knife is an annotation processing library that helps streamline boilerplate Java code in Android views. At compile time, Butter Knife annotations are processed to generate the relevant UI code to make views function properly.

Categories
Support Corner

Protecting .NET applications that use Entity Framework

Reading Time: 2 minutes

Entity Framework is an object-relational mapping (ORM) framework used in Xamarin, WPF, ASP.NET and many other types of .NET applications. It greatly simplifies the code that a developer typically needs to write for database access and querying. 

Categories
Support Corner

Protecting Java applications that use Spring Framework Core

Reading Time: 3 minutes

DashO has support for protecting applications that use Spring Framework Core. Spring can be configured either by custom annotations or XML configuration files, and DashO has support for both. However, applications that use custom annotations require additional handling.

Categories
Support Corner

Protecting .NET applications that use the MVVM pattern

Reading Time: 3 minutes

Model–View–ViewModel (MVVM) is a common pattern used in WPF, Xamarin, and other types of .NET applications. There are different ways to apply the MVVM pattern, but they all share a few underlying concepts. I’d like to discuss these concepts, and how to successfully configure protection with Dotfuscator for MVVM-based apps.