How would one go about doing a case-insensitive search on a column encrypted with Always Encrypted?
The problem arises when you encrypt email addresses for example.
When encrypted, [email protected] != [email protected]
Is the best solution truly to duplicate the encrypted column with the ToLower version of the text to search against?
ToLower
version and store that instead. When the matching rows are returned, further compare them to see if it's really John Doe in all variations we got, or whether Jane came along with. This hash is smaller and reveals less about the column than even a separate encrypted version would, but obviously searching this way is more complicated for clients. Also, you need an expert to tell you if the hash must be cryptographically secure for this purpose. I think you'd be OK with most any hash, but I'm no cryptographer.