Launch price: every exam for $29.99 a year, for the first 300 buyers. See the price

CertStreak
Menu

Implement Always Encrypted

A worked example

Complete the statement

You are using the SQL Server Management Studio Encrypt Columns wizard to protect two columns in the Sales.Customer table with Always Encrypted. Secure enclaves are not configured.

  • CustomerTaxID: the application filters rows with WHERE CustomerTaxID = @id and joins it to the Sales.Invoice table.
  • CardVerificationCode: stores a three-digit card verification code. The application only returns this column in result sets and never filters, joins or groups on it.

Both columns must be encrypted. For each column, you must use the most secure encryption type that still supports the application's queries.

Which encryption type should you select for each column?

Set the encryption type of CustomerTaxID to and the encryption type of CardVerificationCode to .

  • Blank 1: Deterministic (correct answer)

    Deterministic encryption always produces the same encrypted value for the same input, so equality filters and joins still work. Randomized encryption encrypts the same value differently each time, so without secure enclaves the column can only be returned, which breaks the WHERE filter and the join. Plaintext leaves the column unencrypted, which fails the requirement to encrypt both columns.

  • Blank 2: Randomized (correct answer)

    Randomized encryption is more secure than deterministic encryption and is recommended for columns with few, guessable values such as a three-digit verification code. Because the column is only returned in results, randomized encryption's limitation does not affect the application. Deterministic would work for the queries, but it is less secure, so it fails the most-secure requirement. Plaintext leaves the column unencrypted.

Why

Deterministic encryption keeps a value's encrypted form consistent, which is what allows equality comparisons, joins, grouping and indexing. CustomerTaxID needs it for its filter and join. Randomized encryption is the more secure choice and is recommended for low-cardinality, guessable data such as a card verification code. It suits CardVerificationCode because that column is only returned in results.

Practise this topic until it's automatic.

Ten questions a day, every answer explained, and misses that come back until you beat them.

Start free