将始终加密证书放在IIS 7.5 Web服务器上的哪个位置?

Roa*_*ast 6 asp.net iis iis-7.5 sql-server-2016 always-encrypted

我们有一个使用Always Encrypted的SQL Server 2016数据库。我们最近发布的ASP.net网站尝试从该数据库中提取数据,当它出现时,我们将收到此错误:

Error: Failed to decrypt column 'EnSSd'. Failed to decrypt a column encryption key using key store provider: 'MSSQL_CERTIFICATE_STORE'. The last 10 bytes of the encrypted column encryption key are: 'B8-48-B3-62-90-0B-1D-A6-7D-80'. Certificate with thumbprint '97B0D3A64CADBE86FE23559AEE2783317655FD0F' not found in certificate store 'My' in certificate location 'CurrentUser'. Verify the certificate path in the column master key definition in the database is correct, and the certificate has been imported correctly into the certificate location/store. Parameter name: masterKeyPath

现在我们知道这意味着证书尚未放置在服务器上的正确位置。在开发过程中,我们只是将证书放在“个人证书存储”下的“证书”管理单元中就可以了,但是现在该站点已经发布,我们尝试在Web服务器上进行相同的操作,但是它不起作用(我们有点想通了)不会)。

网站上启用了匿名身份验证,匿名用户身份为IUSR。ASP.NET模拟已禁用。

放置证书的适当位置在哪里?


更新-通过将“应用程序池标识”帐户更改为创建证书的帐户,使它可以工作。也是将证书添加到Web服务器上“当前用户个人”列表时使用的帐户。我们宁愿不使用此帐户,因此再次将证书放置在正确的位置在哪里?

Jac*_*ans 3

始终加密要求访问数据库的用户同时拥有公钥和私钥,这似乎要求您使用该帐户来生成证书,因为他们将拥有此密钥。

\n\n

我通常做的是生成证书并使用私钥和安全密码导出证书。然后将带有密钥的证书导入到您用于运行应用程序池的帐户的个人存储中。这不能是通用集成帐户,而必须是您指定的服务帐户。

\n\n

以用户身份运行 powershell 脚本:

\n\n
whoami\nCOMPUTER\\myIISPoolUser\nSet-Location -Path cert:\\localMachine\\my\nImport-PfxCertificate \xe2\x80\x93FilePath c:\\AlwaysEncrypt.pfx\n
Run Code Online (Sandbox Code Playgroud)\n\n

或使用MMC。

\n\n
whoami\nCOMPUTER\\myIISPoolUser\ncertmgr.msc\n
Run Code Online (Sandbox Code Playgroud)\n\n

您还必须允许应用程序池用户加载用户配置文件

\n