bitflipper
New member
- Local time
- Today, 04:46
- Joined
- Mar 14, 2017
- Messages
- 5
SQL Server 2016 Always Encrypted Parameterization
I'm evaluating whether or not SQL Server 2016 Always Encrypted will work with an existing MS Access 2010 Application that I support.
Here's my current roadblock:
My application calls many SQL Server stored procedures that require parameters. I use the following function to make those calls:
Calls to this function will now include parameters that are clear text versions of values encrypted in the database.
When this happens, I get the following error.
I've done some investigation on Always Encrypted Parameterization. It requires one of two technologies
- .NET
- ODBC 13.1 For SQL Server
Since this is an MS Access application, .NET is not applicable. Further, I assume that my strategy for calling Stored Procedures bypasses ODBC 13,1 parameterization.
Any ideas on how I can resolve this problem or is Always Encrypted not a fit for my application?
I'm evaluating whether or not SQL Server 2016 Always Encrypted will work with an existing MS Access 2010 Application that I support.
Here's my current roadblock:
My application calls many SQL Server stored procedures that require parameters. I use the following function to make those calls:
Code:
Public Function ExecuteSPWithParamsQuery(poQDFStub As DAO.QueryDef, psParameterString As String) As DAO.Recordset
'-------------------------------------------------------------------------------------------------
' Purpose : Execute an SQL pass-through query that calls a stored procedures requiring parameters.
'
' Params : poQDFStub: pass through query with name of SPROC
' : psParameterString : one or more parameters to be appended to poQDFStub
'
' Returns : Dao.Recordset(dbOpenSnapshot)
'-------------------------------------------------------------------------------------------------
'
If G_HANDLE_ERRORS Then On Error GoTo ErrorHandler
Dim rstResult As DAO.Recordset
'db interface
Dim dbs As DAO.Database: Set dbs = CurrentDb
Dim qdfResult As DAO.QueryDef: Set qdfResult = dbs.CreateQueryDef(vbNullString)
'setup pass through
With qdfResult
.Connect = poQDFStub.Connect
.SQL = poQDFStub.SQL & " " & psParameterString
.ODBCTimeout = 0
.ReturnsRecords = True
End With
'setup result
Set rstResult = qdfResult.OpenRecordset(dbOpenSnapshot, dbSQLPassThrough + dbReadOnly + dbFailOnError)
ExitHere:
'housekeeping
On Error Resume Next
'add cleanup here
Set qdfResult = Nothing
Set dbs = Nothing
'exit protocol
On Error GoTo 0
Set ExecuteSPWithParamsQuery = rstResult
Set rstResult = Nothing
Exit Function
ErrorHandler:
Err.Source = "SQLStoredProcedureHelper.ExecuteSPWithParamsQuery"
HandleError
Resume ExitHere
End Function
Calls to this function will now include parameters that are clear text versions of values encrypted in the database.
When this happens, I get the following error.
206 [Microsoft][ODBC SQL Server Driver][SQL Server] Operand type clash: varchar is incompatible with nvarchar(255) encrypted with (encryption_type = 'DETERMINISTIC', encryption_algorithm_name = 'AEAD_AES_256_CBC_HMAC_SHA_256', column_encryption_key_name = 'CEK_Auto1', column_encryption_key_database_name = 'sandbox')
I've done some investigation on Always Encrypted Parameterization. It requires one of two technologies
- .NET
- ODBC 13.1 For SQL Server
Since this is an MS Access application, .NET is not applicable. Further, I assume that my strategy for calling Stored Procedures bypasses ODBC 13,1 parameterization.
Any ideas on how I can resolve this problem or is Always Encrypted not a fit for my application?
Last edited: