这看起来是一个非常好的功能,但我明白它只有应用程序可以看到列的未加密文本,对吧?
带有SQL查询的管理员是否可以看到未加密的数据?或者它必须始终来自应用程序?
如果是,您可以发布一个小查询来显示此信息
SQL Server 2016的Express版本中是否提供SQL Server的新加密"静止和运动"功能?
.net sql-server sql-server-express sql-server-2016 always-encrypted
我得到一个SqlException:
操作数类型冲突:varchar 与使用加密的 varchar(50) 不兼容 (encryption_type = 'DETERMINISTIC', encryption_algorithm_name = 'AEAD_AES_256_CBC_HMAC_SHA_256', column_encryption_key_name = 'CEK_Auto1', column_encryption_key_name_1L_General encryption_property_key_database_1Latinr_Inc.从客户端收到元数据。该错误发生在批处理调用期间,因此客户端可以通过调用 sp_describe_parameter_encryption 刷新参数加密元数据并重试。
我的 C# 代码:
using (var connection = new SqlConnection(GetConnectionString()))
{
using (var cmd = new SqlCommand("Clients_Insert", connection))
{
cmd.CommandType = CommandType.StoredProcedure;
cmd.Parameters.Add("@Email", SqlDbType.VarChar, 50).Value = client.Email;
cmd.Parameters.Add("@ContactPerson", SqlDbType.VarChar, 400).Value = client.ContactPerson;
connection.Open();
cmd.ExecuteNonQuery();
}
}
Run Code Online (Sandbox Code Playgroud)
还有我的存储过程:
ALTER PROCEDURE [dbo].[Clients_Insert]
@Email VARCHAR(50),
@ContactPerson VARCHAR(400)
AS
BEGIN
INSERT into dbo.Clients(Email, ContactPerson)
VALUES (@Email, @ContactPerson);
SELECT SCOPE_IDENTITY();
END;
Run Code Online (Sandbox Code Playgroud)
我将数据插入未加密的字段没有问题。
我找到了这篇文章
http://dataap.org/sql-2016-ctp/column-level-encryption-using-always-encrypted-in-sql-server-2016/
我的问题是类似的,但我还没有找到解决方案。
I maintain a classic ASP app (yeah, I know, we're working on it) and need to access Always Encrypted columns in SQL 2017.
I've imported the cert and tested in SSMS and PowerShell and that much works. The best I've been able to do in ASP is to get the encrypted value as a byte array. I've tried more connection string combinations than I can remember. My ASP dev box is Windows 10; the data server is SQL 2017.
cnn …Run Code Online (Sandbox Code Playgroud) 请帮助我修复 SQL Sever 2016 中的以下查询,其中列 FIRST_NAME、LAST_NAME 始终是加密的。
SELECT * FROM MY_TABLE
WHERE (LAST_NAME LIKE '%[@,#,$,%,*]%' OR LAST_NAME LIKE '%,%')
OR (FIRST_NAME LIKE '%[@,#,$,%,*]%' OR FIRST_NAME LIKE '%,%');
Run Code Online (Sandbox Code Playgroud)
我收到以下错误,因为列始终是加密的,而且我无法声明变量并将字符串分配给它。
Msg 206, Level 16, State 2, Line 1
Operand type clash: varchar(50) encrypted with (encryption_type = 'DETERMINISTIC', encryption_algorithm_name = 'AEAD_AES_256_CBC_HMAC_SHA_256', column_encryption_key_name = 'CEK_POC_CERTSTORE', column_encryption_key_database_name = 'UIM-LOCAL-DB') collation_name = 'Latin1_General_BIN2' is incompatible with varchar
Run Code Online (Sandbox Code Playgroud) 使用 SQL Server SSL(连接字符串中的 Encrypted=true)+ TDE 与使用 SQL Server Always Encrypted 有什么区别?
关于 RGPD,一个比另一个更适应吗?
使用 .NET Core 3.1 和 SQL Always Encrypted 时出现以下错误。3.1支持这个吗?也许我在这里遗漏了一些东西..
Keyword not supported: 'column encryption setting'.
Run Code Online (Sandbox Code Playgroud)
目前已安装以下软件包
<PackageReference Include="Microsoft.ApplicationInsights.AspNetCore" Version="2.12.0" />
<PackageReference Include="Microsoft.AspNetCore" Version="2.2.0" />
<PackageReference Include="Microsoft.AspNetCore.Mvc" Version="2.2.0" />
<PackageReference Include="Dapper" Version="2.0.30" />
<PackageReference Include="Microsoft.AspNetCore.Razor.Design" Version="2.2.0" PrivateAssets="All" />
<PackageReference Include="Microsoft.Data.SqlClient.AlwaysEncrypted.AzureKeyVaultProvider" Version="1.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.AzureKeyVault" Version="3.1.1" />
<PackageReference Include="Serilog.AspNetCore" Version="3.2.0" />
<PackageReference Include="Serilog.Extensions.Logging" Version="3.0.1" />
<PackageReference Include="Serilog.Settings.Configuration" Version="3.1.0" />
<PackageReference Include="Serilog.Sinks.ApplicationInsights" Version="3.0.4" />
<PackageReference Include="Serilog.Sinks.Console" Version="3.1.1" />
Run Code Online (Sandbox Code Playgroud) 我正在尝试设置一个 PowerShell 脚本以在我们的 Azure SQL Server 数据库上启用始终加密。我正在遵循本指南,其中提供了以下示例代码:
# Import the SqlServer module
Import-Module "SqlServer"
# Connect to your database
# Set the valid server name, database name and authentication keywords in the connection string
$serverName = "<Azure SQL server name>.database.windows.net"
$databaseName = "<database name>"
$connStr = "Server = " + $serverName + "; Database = " + $databaseName + "; Authentication = Active Directory Integrated"
$database = Get-SqlDatabase -ConnectionString $connStr
# List column master keys for the specified …Run Code Online (Sandbox Code Playgroud) 使用 SQL Server 2017 我按照这篇文章应用了 Always Encrypt 技术:https : //www.codeproject.com/Articles/1110564/Always-Encrypted-feature-in-SQL-Server 简单地说:
用于步骤 1.的证书是使用向导生成的并保存在:
密钥库: Windows Certificate Store - Local Machine
我创建了一个非常简单的控制台应用程序,它使用 EF 尝试从我对列进行加密的表中获取数据。
我在连接字符串中添加了这个:column encryption setting=Enabled.
当我尝试获取数据时:
using (MyEntities en = new MyEntities())
{
var x = en.TableHasColEnc.ToList();
}
Run Code Online (Sandbox Code Playgroud)
我收到此错误:
'未能解密列'X'。无法使用密钥存储提供程序解密列加密密钥:“MSSQL_CERTIFICATE_STORE”。加密列加密密钥的最后 10 个字节是:'XX-XX-XX-XX-XX-XX-XX-XX-XX-XX'。在证书位置“LocalMachine”的证书存储“My”中找不到带有指纹“...”的证书。验证数据库中列主密钥定义中的证书路径是否正确,并且证书已正确导入到证书位置/存储中。参数名称:masterKeyPath'
我了解到运行此应用程序的用户无法访问该位置以获取证书,但为什么呢?
如果我以管理员身份运行该应用程序,它将正常工作。
我打开mmc并检查Certificates (Local Computer)并找到了在步骤 1 中使用的证书。它看起来在本地机器中正确,而不是当前用户。
为什么我会收到此错误以及如何解决?
即使在 SQL Server 2019 版本中,我也无法对加密列进行模式匹配。
SQL Server 2019
加密前
select *
from messageencryption;
Run Code Online (Sandbox Code Playgroud)
输出:
id msgcode msg
-------------------------------------------
1 AA56B this is a text message
2 AA56C this is a text123 message
3 AA56D EXTENDED BOOTCAMP
4 AA56E extended bootcamp
5 AA56J advance happy new year
6 AA56K oneteam
7 AA56L cricket team consists of 11 players
8 AA56M indian cricket team
select *
from messageencryption
where msg like '%team%';
Run Code Online (Sandbox Code Playgroud)
输出:
id msgcode msg
----------------------------
6 AA56K onesmallteam
7 AA56L …Run Code Online (Sandbox Code Playgroud) 我正在尝试将 Always Encrypted 应用程序部署到 Amazon AWS。有一个 2016 RDS 数据库和一个托管 ASP.NET 4.6 应用程序的 Windows Server 2016。
在 Windows Server 上,当应用程序在网络服务或应用程序池标识下运行时,我们得到的正是我非常确定的问题。
我们的错误:
System.Data.SqlClient.SqlException (0x80131904): Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding. ---> System.ComponentModel.Win32Exception (0x80004005): The wait operation timed out
到目前为止,没有任何效果(除了以管理员身份运行应用程序之外),我们不知道下一步该尝试什么。我们到处寻找某种“微软官方部署指南”,但所有这些都是关于如何在本地开发环境中使始终加密工作的教程,而不是关于服务器部署。
always-encrypted ×11
sql-server ×10
encryption ×3
.net ×1
asp-classic ×1
asp.net ×1
c# ×1
iis ×1
powershell ×1
sql ×1
ssl ×1
tde ×1