如果开发人员在自己的计算机上使用RSAProtectedConfigurationProvider加密连接字符串app.config部分,并将其随后部署到用户的工作站,那么该用户的工作站(或服务器)是否可以自动解密连接字符串?是否需要某种密钥导出/安装?这是如何工作的?我知道它不是百分之百安全的。我想知道的是,这样加密的连接字符串是否容易部署和/或与之配合工作。
这是可以实现的。有API可以实现(请查看System.Security.Cryptography
命名空间),或者从命令行中可以使用aspnet_regiis:
aspnet_regiis -pc -exp : create an exportable key pair
aspnet_regiis -px : export an RSA key pair to an XML file
aspnet_regiis -pi : import an RSA key pair from an XML file
aspnet_regiis -pa : add access for an account to a key container