Class 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 String ENV_MASKER_KEY
      Environment variable used to define the environment variable holding the masking key
    • 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
    • Constructor Detail

      • MDfromHTMLMasker

        public MDfromHTMLMasker()
    • 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 Exception
        Masks 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 Exception
        Masks 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 Exception
        Unmasks 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 Exception
        Unmasks 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