obfuscation-core

Provides functionality for obfuscating text. This can be useful for logging information that contains sensitive information.

Besides providing a framework that can be extended to provide simple or complex obfuscators, this library comes with a small set of predefined obfuscators. Most can be found through factory methods on class Obfuscator. See Examples for more information.

Streaming obfuscation

An Obfuscator has method streamTo which takes a StringBuilder, Writer or other Appendable, and returns a Writer that will obfuscate the written text automatically.

Preventing leaking string representations

The following methods of Obfuscator can be used to help prevent accidentally leaking string representations of objects, for instance by logging them:

  • obfuscateList, obfuscateSet and obfuscateCollection create List, Set and Collection decorators respectively that obfuscate separate elements when calling toString().
  • obfuscateMap creates a Map decorator that obfuscates separate values (but not keys) when calling toString().
  • obfuscateObject creates a wrapper around an existing object that obfuscates the object when calling toString().

Obfuscating complex structures

Besides obfuscating simple text, it's possible to obfuscate complex structures using the following classes and libraries:

Writing custom obfucators

Package com.github.robtimus.obfuscation.support provides several classes that can be used to create custom obfuscators.

Extensions