StrEncrypt macro

<< Click to Display Table of Contents >>

Navigation:  Themida > SecureEngine® Macros >

StrEncrypt macro

The STR_ENCRYPT/STR_ENCRYPTW macro allows you to mark regions of code where all referenced strings inside the region will be encrypted in protection time and decrypted in runtime when required by the target application. The decryption is performed inside the SecureEngine Virtual Machine and the location of the decrypted string is different from the original one in the unprotected application. The original location of the string is destroyed and never used again in the protected application.

 

If you are using Unicode strings in your application, you have to use the macro STR_ENCRYPTW which can process Unicode strings.

 

NOTE: The current version of SecureEgine® does not support this macro for .NET languages or Visual Basic compiled in PCode mode.

 

Click to expand/collapseShow Delphi Macro Usage
Click to expand/collapseShow C/C++ Macro Usage
Click to expand/collapseShow Visual Basic Macro Usage

 

Remarks

 

For further protection you can put a VM macro around the "STR_ENCRYPT" macro, so all your code area where your strings are used is also virtualized. Example:

 

VM_START

 

 STR_ENCRYPT_START

 

 ' your code goes here

 

STR_ENCRYPT_END

 

VM_END

 

There are some internal options that can be added to increase the protection of the STR_ENCRYPT macro. You can add the following entries in the Advanced Options panel:

OPTION_MACROS_ENCRYPT_STRINGS_DECRYPT_ON_HEAP=YES

The string will be decrypted on an allocated block in the heap

 

OPTION_MACROS_ENCRYPT_STRINGS_REENCRYPT=YES

The decrypted string on the heap will be destroyed when the STR_ENCRYPT_END marker is executed