Package com.mdfromhtml.core
Class MDfromHTMLMasker
- java.lang.Object
-
- com.mdfromhtml.core.MDfromHTMLMasker
-
public class MDfromHTMLMasker extends Object
Utility class to provide obfuscation of text and JSON objects. Content that is masked can also be unmasked using the complementary functions.
-
-
Field Summary
Fields Modifier and Type Field Description static StringENV_MASKER_KEYEnvironment variable used to define the environment variable holding the masking key
-
Constructor Summary
Constructors Constructor Description MDfromHTMLMasker()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static voidmain(String[] args)static Stringmask(String unmaskedText)Masks a text stringstatic com.api.json.JSONArraymaskArray(com.api.json.JSONArray array)Masks all string values found in the supplied arraystatic com.api.json.JSONObjectmaskObject(com.api.json.JSONObject object)Masks all string values found in the supplied objectstatic Stringunmask(String maskedText)Used to unmask masked contentstatic com.api.json.JSONArrayunmaskArray(com.api.json.JSONArray array)Unmasks any string values found in the array elementsstatic com.api.json.JSONObjectunmaskObject(com.api.json.JSONObject object)Unmasks all string values found within the supplied object
-
-
-
Field Detail
-
ENV_MASKER_KEY
public static final String ENV_MASKER_KEY
Environment variable used to define the environment variable holding the masking key- See Also:
- Constant Field Values
-
-
Method Detail
-
main
public static void main(String[] args)
-
mask
public static String mask(String unmaskedText) throws Exception
Masks a text string- Parameters:
unmaskedText- text to be masked- Returns:
- masked version of supplied text
- Throws:
Exception- if there is a problem with the cryptographic environment
-
maskArray
public static com.api.json.JSONArray maskArray(com.api.json.JSONArray array) throws ExceptionMasks all string values found in the supplied array- Parameters:
array- Array of elements whose string values are to be masked- Returns:
- Array of masked elements
- Throws:
Exception- if there is a problem with the cryptographic environment
-
maskObject
public static com.api.json.JSONObject maskObject(com.api.json.JSONObject object) throws ExceptionMasks all string values found in the supplied object- Parameters:
object- the JSON object whose string values are to be masked- Returns:
- the masked JSON object
- Throws:
Exception- if there is a problem with the cryptographic environment
-
unmask
public static String unmask(String maskedText) throws Exception
Used to unmask masked content- Parameters:
maskedText- masked text to be unmasked- Returns:
- unmasked version of input text
- Throws:
Exception- if there is a problem with the cryptographic environment
-
unmaskArray
public static com.api.json.JSONArray unmaskArray(com.api.json.JSONArray array) throws ExceptionUnmasks any string values found in the array elements- Parameters:
array- Array whose string elements are to be unmasked- Returns:
- Array with unmasked elements
- Throws:
Exception- if there is a problem with the cryptographic environment
-
unmaskObject
public static com.api.json.JSONObject unmaskObject(com.api.json.JSONObject object) throws ExceptionUnmasks all string values found within the supplied object- Parameters:
object- JSON object to be unmasked- Returns:
- unmasked JSON object
- Throws:
Exception- if there is a problem with the cryptographic environment
-
-