I am trying to figure out a secure way to store secret keys used in the hashing of social security numbers.
The idea is for de-identification of research subjects yet still permitting follow-ups over time by hashing a secret key concatenated with the SSN and using that as the unique identifier.
The steps I conceived of is the following:
- At time 0, when data on subject A is collected, randomly generate a secret key and concatenate it with the SSN before hashing it.
- Replace the SSN with the hash value. This de-identified record will be used for research purposes.
Store the SSN and generated secret key somehow.
At time 1, when further data of subject A is collected, we want to append this new data to the data collected previously. Search for the secret key using the SSN and then hashing again to get the required hash value.
I am struggling in Step 3 and looking for best practices in such a scenario. It seems that if I were to just store the SSN together with the secret key in a text file then the risk for reidentification is high once the intruder gets access of the file.
Any help is greatly appreciated!