sql server - How to perform "Order by" on an encrypted column (deterministic encryption - SQL 2016) -


how perform "order by" on encrypted column (deterministic encryption - sql server 2016) ?

i getting error when executed on ssms 2017 (with required settings ae)

select *  [dbo].[x]  order lastname 

the lastname column defined this:

[lastname] [varchar](60) collate latin1_general_bin2 encrypted (column_encryption_key = [x] 

i error:

msg 33299, level 16, state 2, line 9
encryption scheme mismatch columns/variables 'lastname'. encryption scheme columns/variables (encryption_type = 'deterministic', encryption_algorithm_name = 'aead_aes_256_cbc_hmac_sha_256', column_encryption_key_name = 'x', column_encryption_key_database_name = 'x') , expression near line '3' expects (encryption_type = 'plaintext') (or weaker).

order not supported on encrypted columns.

more details can found on this article

the database engine never operates on plaintext data stored in encrypted columns, still supports queries on encrypted data, depending on encryption type column. encrypted supports 2 types of encryption: randomized encryption , deterministic encryption.

deterministic encryption generates same encrypted value given plain text value. using deterministic encryption allows point lookups, equality joins, grouping , indexing on encrypted columns. however, may allow unauthorized users guess information encrypted values examining patterns in encrypted column, if there small set of possible encrypted values, such true/false, or north/south/east/west region. deterministic encryption must use column collation binary2 sort order character columns.

randomized encryption uses method encrypts data in less predictable manner. randomized encryption more secure, prevents searching, grouping, indexing, , joining on encrypted columns. use deterministic encryption columns used search or grouping parameters, example government id number. use randomized encryption, data such confidential investigation comments, not grouped other records , not used join tables. details on encrypted cryptographic algorithms, see encrypted cryptography.


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -