Configure PreEmptive Protection™ DashO™ String Encryption from these pages in the DashO user interface: String Encryption - Options, String Encryption - Include, String Encryption - Exclude, and Custom String Encryption. Use them to turn String Encryption on, set its strength, control where DashO places decrypters, choose which methods to protect, and plug in your own encryption.
To learn how String Encryption works, see String Encryption.
Prerequisites
- A DashO project.
- For Custom Encryption: A JAR file that contains your encryption class and method, and a decryption class and method in your project inputs. See Custom Encryption for the method requirements.
Configure String Encryption Options
- Go to String Encryption to open the String Encryption - Options page.
- Select Encrypt Strings to enable String Encryption globally.
- Use the Level slider to set the encryption strength, from 1 to 10. The default is 2.
- In Decrypters, set the number of decryption methods DashO generates. The default is 2.
- (Optional) Change which classes can contain decrypters:
- Next to Decrypter Class, click Edit….
- Set the selection criteria in the properties dialog.
- Select OK.
- Select Intern Strings to make the injected decrypters to call .intern() on the decrypted strings before returning them.
- (Optional) Specify a string encryption input map file for Incremental Obfuscation.
- (Optional) Specify the location for a string encryption output map for Incremental Obfuscation.
- Save your project and build it to apply the changes.
Configure String Encryption Map Files
Use map files with Incremental Obfuscation, so DashO reproduces the decrypters from your earlier build.
- On the String Encryption - Options page, enter the location of the map file from your earlier build in Input. DashO then ignores the Level and Decrypters settings.
- In Output, enter the location where DashO writes the map file for this build.
- Save your project and build it to apply the changes.
Choose Which Methods to Protect
Use the String Encryption - Include and String Encryption - Exclude pages to select the methods, classes, or entire packages whose strings DashO encrypts. Both pages use the DashO rules editor. For details on creating, editing, and previewing rules, see Graphical Rules Editor.
| Goal | Page | Result |
| Avoid runtime decryption costs in performance-sensitive code | String Encryption - Exclude | DashO encrypts strings in all methods not covered by an exclude rule. |
| Protect only the code that contains sensitive strings | String Encryption - Include | DashO encrypts strings only in methods covered by an include rule. |
- Go to String Encryption > Include or String Encryption > Exclude to open the String Encryption - Include or String Encryption - Exclude page.
- Create rules for the methods, classes, or packages you want to include or exclude. See Graphical Rules Editor.
- (Optional) Preview your rules to confirm which methods they match.
- Save your project and build it to apply the changes.
Configure Custom Encryption
Use the Custom String Encryption page to configure Custom String Encryption.
- Go to String Encryption > Custom to open the Custom String Encryption page.
- Select Use Custom Encryption to enable Custom String Encryption globally.
- In Encryption Jar, enter the JAR file that contains your encryption class and method. The JAR file is external to your project. DashO uses it to encrypt strings during obfuscation.
- Next to Encryption Class and Method, select Choose…, then select the method to encrypt the text. The dialog lists the methods in the encryption JAR file that meet the requirements. This method isn't part of the output.
- Next to Decryption Class and Method, click Choose…, then select the method to decrypt the text. The dialog lists the methods in your inputs that meet the requirements. This class and method stay in your output, though other project settings may rename or obfuscate them.
- In the Include section, create rules for the methods, classes, and packages to protect with Custom String Encryption. For more information, see Graphical Rules Editor.
- Save your project and build it to apply the changes.
Limitations and Troubleshooting
| Issue | Resolution |
| The Input and Output map file settings are missing. | Your project uses Android Mode, which doesn't support String Encryption Map Files. |
| Changes to Level or Decrypters have no effect. | An Input map file is set. DashO reproduces the decrypters in the map file and ignores these settings. |
| DashO skips methods you expected it to protect. | Check the String Encryption - Include page. If it contains any rules, DashO encrypts strings only in the methods those rules cover. |
| Choose… doesn't list your method. | The method doesn't meet the requirements for Custom Encryption. |