Reference

Command line

Every flag of the CLI, the environment variables it reads and its exit codes.

The CLI takes a configuration file and a few flags. Everything else is set in the configuration.

Usage

hashguard -config <config.json> [-input <in.jar>] [-output <out.jar>] [-libraries <paths>]
hashguard -licence-login [-licence-key <key>]

Flags

FlagValueEffect
-configpathThe configuration file. Required for every run.
-inputpathThe jar to protect. Overrides input in the configuration.
-outputpathThe jar to write. Overrides output in the configuration.
-librariespathsLibrary jars separated by the platform path separator (: on macOS and Linux, ; on Windows). Replaces libraries from the configuration.
-licence-loginnoneStores a licence key in the operating system keyring and exits. Prompts for the key unless -licence-key is given.
-licence-keykeyThe key stored by -licence-login.

The multi-slot flags -multislot, -outputdir and -keysoutput belong to the hardened runtime.

Environment variables

VariableEffect
PLR_LICENCE_KEYThe licence key. Read before the keyring; use it in CI and on headless machines.

Exit codes

CodeMeaning
0The protected jar was written.
1The licence was rejected, or the run reported errors.
2Invalid invocation: no -config, or missing values for the flags used.

Examples

Protect the jar named in the configuration:

hashguard -config obfuscator-config.json

Reuse one configuration for several jars:

hashguard -config obfuscator-config.json -input build/libs/core.jar -output dist/core.jar
hashguard -config obfuscator-config.json -input build/libs/tools.jar -output dist/tools.jar

Store the licence key on a workstation:

hashguard -licence-login