sqlsql-serveralways-encrypted

SQL Server Always Encrypted C++


I am trying to set up Always Encrypted option for my database.

By following the Microsoft link, I was able to do the same and also verify using SSMS.

However, I am facing a problem while using the same feature in my application.

My client application is developed in C++.

When ever I try to retrieve data from the encrypted columns, the values are not in plain text but encrypted.

I tried setting all possible flags in my connection string but nothing seems to work.

Based on this, I have two questions:

  1. What is the connection string flag to be used for enabling Always Encrypted in a C++ application that uses OpenEx API to connect to dB?
  2. Is it not supported in C++? Most of the samples mention usage of .NET framework 4.6.

Solution

  • AlwaysEncrypted requires the client driver to provide the encryption key and to understand the column encryption metadata.

    From C/C++ you should use ODBC for AlwaysEncrypted support. See Using Always Encrypted - ODBC Driver for SQL Server.