Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/sql-server/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在SQL Server数据库中安全地存储API凭据?_C#_Sql Server_Cryptography - Fatal编程技术网

C# 如何在SQL Server数据库中安全地存储API凭据?

C# 如何在SQL Server数据库中安全地存储API凭据?,c#,sql-server,cryptography,C#,Sql Server,Cryptography,在Windows服务中,我需要能够检索存储在同一网络上的SQL Server 2012数据库中的第三方REST API的凭据。我的每个客户可能都有一个不同的API凭证分配给他们。例如: Customer Name | API ID | API Password In Plain Text ----------------------------------------------------- Customer 1 1234 somepassword Customer 2

在Windows服务中,我需要能够检索存储在同一网络上的SQL Server 2012数据库中的第三方REST API的凭据。我的每个客户可能都有一个不同的API凭证分配给他们。例如:

Customer Name | API ID | API Password In Plain Text
-----------------------------------------------------
Customer 1      1234     somepassword
Customer 2      1234     somepassword
Customer 3      5678     anotherpassword
在该服务的第一次迭代中,所有客户都使用相同的API凭据,并使用在Windows服务的app.config中对其进行加密


我是否只使用.NET framework提供的一种加密/解密方法,并将该值存储在数据库中?例如,这里提供的解决方案之一:?任何我可以研究的建议或其他解决方案?

如@SyntaxGoonoo所建议,我计划使用数据保护API(DAPI)提供的。我将设置为以与Windows服务关联的CurrentUser身份运行,以解密SQL数据库中的凭据。我可能必须创建另一个应用程序来加密凭据并将其存储在数据库中(使用相同的用户上下文)

以下是一些额外的资源:


也许可以考虑使用MS ProtectedData类-为了存储密码,可以使用类似PBKDF2的东西。