The PreMark Editor
The PreMark editor allows you to select assemblies for watermarking and to set up the watermark that will be applied to the selected assemblies.
The list of input assemblies is displayed on the left. Checking the box in front of an assembly selects it for watermarking.
You can choose to encrypt your watermark string before it is applied to your input assemblies. The encryption is based on a pass phrase that you provide. When you check the Encrypt Using Passphrase box, the passphrase entry text box becomes enabled and you can then enter your passphrase.
Dotfuscator cannot predict whether an encoded and potentially encrypted watermark string will fit in a given output assembly. At watermarking time, if the string does not fit, you can tell Dotfuscator what to do via the When Watermark String is Too Big dropdown. You can select whether it should automatically truncate the watermark string and issue a warning, or halt the build with an error.
Your watermark string must be encoded to bytes before it is applied to an assembly. Dotfuscator provides several built in Character Maps that are optimized for small, commonly used, character sets. Using one of them will allow larger watermark strings to fit in any given assembly. If none of the specialized character maps fit your needs, you can select the standard UTF-8 encoding.
Dotfuscator defines several character maps you can use to encode your watermark string. If space is an issue, you can choose a smaller encoding at the expense of the number of different characters you can use in your string.
||4 bit Hexadecimal||4|
||6 bit Uppercase Alphanumeric and symbols||6|
||6 bit Alphanumeric||6|
||7 bit Alphanumeric and symbols||7|
Dotfuscator’s Config Editor displays the specific characters defined in each character map.
When entering your watermark string, a notification will be displayed if you type a character that is not included in the currently selected character map.
Watermark String Length
The maximum size of the watermark string is governed by your configuration options and by the complexity of the target assembly. In general, bigger strings fit in bigger assemblies. Dotfuscator uses character encodings, called character maps, to minimize the number of bits required to encode a character; a small character encoding allows you to create a longer watermark string for a given assembly.
In addition, the encryption algorithm has a fixed block size. If you choose to encrypt the watermark string, the maximum length of your watermark string may be smaller than it is without encryption.
It is not possible for Dotfuscator to predict the maximum watermark string length until the output assemblies have been generated. You can tell Dotfuscator what to do during a build when your watermark string will not fit in the output assembly. The default setting truncates the string so it fits and prints a warning message to the output window. You can also tell Dotfuscator to stop the build with an error. In both cases, the message indicates the maximum watermark size.
Extracting a Watermark
Dotfuscator ships with a command line tool called
premark that accepts an assembly as input and outputs the watermark if any.
The tool is installed into the same directory as Dotfuscator.
Extracting a Watermark:
premark [options] assembly1[,assembly2, ...] assembly1,...: A list of .NET assemblies or modules. Options: /a Ask for passphrase. /p=passphrase Passphrase to use when decrypting watermark string (none for no encryption).