Advanced Protection for Unreal

Encrypt your code through the Advanced Protection.

1. Requirements

Please ensure that the following programs are installed prior to proceeding with this tutorial.

  • Unreal Engine installed: version 4.1 or later
  • Visual Studio installed : version 2015 or later 

2. Setup

2.1 Recommendation

It is recommended that you try implementing AppSealing with a sample project before continuing to your own project. 

 

2.2 Open project with Visual Studio

① Open the project using the Epic Games Launcher. 
② Click the [File] menu and click [Open Visual Studio]. (Fig.1)

(Fig.1)

 

2.3 Add AppSealing Unreal Support files

① Download the AppSealing Unreal Support files and extract.

Download link: AppSealing Unreal Support files

② Copy the AppSealingSecurity_Unreal.cpp and AppSealingSecurity_Unreal.h files to the project folder.
Path: [Unreal project folder]/[Source]/[Project folder]

③ Add the files from the Visual Studio Solution Explorer. (Fig.2)
Path: [Project]/[Source folder]/right click [Project folder] > Add > click "Existing item"

(Fig.2)


④ Select AppSealingSecurity_Unreal.h and AppSealingSecurity_Unreal.cpp files that was copied to project folder and click add.

 

3. Add AppSealing Tag

3.1 Add Header

① Open AppSealingSecurity_Unreal.cpp file from the Solution Explorer. 
② Edit the #include "project_name.h" in the second line to the project's file name. (Fig.3)

ex.) #include "Match3.h"

 

(Fig.3)

 

3.2 Add Tag

Header and 5 tags are provided to protect Unreal code.

 

#include "AppSealingSecurity_Unreal.h"

Add this to the source code file header where the tags will be added. (Fig.4)

(Fig.4)

APPSEALING_ENCRYPTION_BEGIN

Add this tag to the beginning of the code that you wish to protect.

Protection is applied from the line after this tag.

 

APPSEALING_ENCRYPTION_END

Add this tag to the end of the code that you wish to protect.

Protection is applied to the line before this tag.

 

APPSEALING_ENCRYPTION_END_RETURN( return value ) 

Add this tag to the end of the code that you wish to protect.

Protection is applied to the line before this tag.

 

APPSEALING_ENCRYPTION_RETURN( return value )

Replace the return statement that has a return value within the protected code.

NOTE :

Return statement that is not replaced within the protected code will result in security hole since it will not be encrypted again once it has been decrypted during run process.

 

APPSEALING_ENCRYPTION_RETURN_VOID

Replace the return statement with no return value within the protected code.

 

3.2.1 Tagging Example 1

Add the tags as shown below to the bool function to protect the whole function.

Replace all the return statement within the function.

(Before)

 

(After)

NOTE :

APPSEALING_ENCRYPTION_BEGIN and APPSEALING_ENCRYPTION_END must be added to the beginning and end of the code if the return statement does not exist in the function.

If the tag was not added or was not added properly a clang compile error will occur during the build process.

 

3.2.2 Tagging Example 2

Add the tags as shown below to the bool function with return statement to protect the whole function.

Replace all the return statement within the function.

(Before)

 

(After)

NOTE :

The last return statement must be replaced with APPSEALING_ENCRYPTION_END_RETURN tag.

 

3.2.3 Tagging Example 3

Add the tags as shown below to the void function to protect the whole function.

This function has a return statement with no value.

Replace all the return statement within the function.

(Before)

 

(After)

NOTE :

Add only APPSEALING_ENCRYPTION_BEGIN and APPSEALING_ENCRYPTION_END tag to the code if the return statement does not exist in the function.

Make sure to replace all return statement with no value with the APPSEALING_ENCRYPTION_RETURN_VOID tag.

 

3.3 Build APK File

① Build APK using the Unreal build feature.
Path: [File] > [Package project] > click [Android]
② Go to Sealing process after the APK has been built.

 

4. Sealing APK

Sealing on the APK is required to activate the security module. Please upload the APK file on the Developer Console page.

Sealing Tutorial Link : Sealing Tutorial

Was this article helpful?
0 out of 0 found this helpful
Have more questions? Submit a request
comment section

0 Comments

Article is closed for comments.