0

Assume I have a PII (personal identifier info) data like email. I plan to encrypt that info with a secret key and keep in a column in database, and mask it in another column like so:

Plaintext : john.smith@gmail.com

Email_masked: “john.sm***@gm”

Encrypted : sadsdfafewfew213asd

So in DB, encrypted and masked is stored.

If a hacker gets access to this DB, can having masked data make it easier to crack the secret?

Ouroboros
  • 101

1 Answers1

0

If the attacker got access to the database they probably have access to the plaintext anyways. But assuming they only gain access to the masked data and the ciphertext this allows them to perform a brute force attack. If they only knew the ciphertext then it's difficult to do a brute force because for each key they guess they cannot know if the output is correctly decoded. But if they have the masked data then for each key they try they can check if the output of their guess matches the masked data and if it does then they know they found the right key. However, AES is designed to be resistant to known-plaintext attacks so even if the attacker had the ciphertext and masked data it would longer than the age of the universe to brute force [1]. If they had a very large amount of data to compare against the encrypted data they could brute force it slightly faster, but still not within a reasonable amount of time [2]. I think the biggest worry is that there are only so many unique last names in the world and if the mask gives away the first 2 letters, the attacker might be able to determine the length of the last name based on the length of the ciphertext and then use the first 2 letters and the length to figure out the most likely last names.

[1] How long would it take to brute force an AES-128 key?

[2] Why is AES resistant to known-plaintext attacks?

Vexcess
  • 11
  • 1