Is there a good way to do repeatable (with the same result) encryption for pseudonymisation where the pseudonym can be decrypted?
I want to set up a system to allow multiple services to communicate about subjects without them being able to join their data together themselves. They would send their requests through a "middleman" service which would translate the IDs to enable communication between the services.
So for instance, a score service and a user info service where the score service could ask for the user's first name without having to know the actual id for this user.
Because I don't want to store a large lookup-table for each service in the middleman I would like to generate the pseudonyms on the fly. So far I've looked at some RSA (OAEP) and AES (CTR, GCM) algorithms. The problem with these (I believe) is that they add some random padding or require a unique initialisation vector (which is there to prevent information about the key to be leaked) which makes the encryption non-repeatable. (Data stays the same but the result changes for every time we encrypt)
The data would be something like secret:service_uuid:object_type:object_id
to make these unique for each object-service pair.
A (maybe ignorant) solution I came up with was to use something like AES
and create iv
from the data (d
) by doing something like this:
$iv = hash(d) \bmod m$
Where m
is the max value for iv
But I'm not sure if this compromises the strength of the encryption algorithm.
Long story short, I have not been able to find any "standard" to solve this, and I have the feeling I might be introducing some vulnerabilities by forcing some algorithm to do something it wasn't designed to do. Does anyone know if there is a better way to do this?