Reputation: 1397
I have a fairly simple SQL Server requirements where I have a column of type int
and I want to encrypt that column given that the function that will be used to encrypt the column should generate the same value each time it is called.
Context
My Trials
ENCRYPTBYKEY
with authenticator and without authenticator however each time I call the function,It generates different value which could be beneficial in some scenarios however mine is not one of them :)ENCRYPTBYASYMKEY
and the same behavior appeared which is different output with each callMy question is, What are the possible solutions to achieve my requirements considering that the function will be used to encrypt tables with millions of records.
Upvotes: 1
Views: 154
Reputation: 35925
What are the possible solutions to achieve my requirements
There is none.
TLDR;
Modern encryption must satisfy several properties, one of each is Semantic security. Semantic security in layman's terms means that if you have encrypted messages you cannot derive any additional information about the plain text message. You requirements, however, directly contradict this, as by having access to enough cyphered messages, one can derive the meaning of the plain text. This is how German machine Enigma was cracked during 2-nd World War (they reused the key, whereas you want to fix IV. The result is the same though - plain text can be revealed).
For this very purpose Initialisation Vectors have been invented and must be used.
What shall you do? Well there are two options really:
Upvotes: 1
Reputation: 1533
You would have to write your own encryption functionality to do this, why would you want to do this though, imo could be a security risk
Upvotes: 0