Navin Chari

Custom TDM Masking Functions

Blog Post created by Navin Chari Employee on Nov 12, 2017

I have recently been working with Fast Data Masker's capability to create custom masking functions in Java, and I would like to describe some of the setup, functions, and orchestration I have created.

 

SETUP

1. Install Eclipse (Eclipse Downloads ) on your machine or VM.

2. Create a project called TDMMasking - This will be used to house all your custom masking scripts

3. Create a package for all your "Prod ready" scripts, you will create the jar files from this location.

    e.g. "com.tdm.masking"

4. Create individual packages (e.g. "checkSumQuebecLicence") for the scripts that you are creating with 2 files:

    One for the code (e.g. "checkSumQuebecLicence", another to execute it ("main")

5. Write the code and test it with the main function.

6. Once successful, copy it into the com.tdm.masking package, compile, and save the jar file into:
     C:\Program Files\Grid-Tools\FastDataMasker\custom\

7. Edit C:\Program Files\Grid-Tools\FastDataMasker\custom_config.xml to incorporate your function

    *Ensure the classname in the xml is the same as your prod ready scripts, i.e. com.tdm.masking

8. Test and implement with FDM

 

FUNCTIONS:

I have created a few function, initially started off with something very simple like changing the case to UpperCase. Then I used it for slightly more complex algorithms. I will describe the checkSumQuebecLicence function below.

 

The Quebec Driver's licence requires the last digit to be calculated based on the rest of the values, and the function I created is run after a series of other masking scripts. Other components of the Quebec DL that needs to align is the person's last name and birthdate. Below is the masking logic sequence:

1. Mask First and Last names with HASHLOV function

2. Set birthdate to the first of the month

3. Use FORMATENCRYPT to randomize certain numbers, but ignore the last 8 characters

4. Use POSITIONMASK to set the the 7th and 8th characters from the right to 01 to align with the birthdate

5. Substring the first character from the last name field and concat with the last 12 digits of the DL

6. Run the custom masking function to change the 13th digit to the value with makes is a valid licence.

 

ORCHESTRATION:

Place all of the scripts in a single bat file and execute. This can also be called via Jenkins.

 

*NOTE there may be performance issues based on the size of the data due to multiple runs, but it still accomplishes the job.

**I have attached the java code for the checkSumQuebecLicence function

Attachments

Outcomes