因此,使用ASPNET_REGIIS.EXE UTIL我做了以下为什么在不提供keyContainerName的情况下加密Web.config文件?
//Create the container
aspnet_regiis -pc MyRSAKey -exp
//Write key to file
aspnet_regiis -px MyRSAKey MyRSAKey.xml
//Install the key into a machine-level RSA key provider.
aspnet_regiis -pi MyRSAKey MyRSAKey.xml
//Grant access to the contrainer
aspnet_regiis -pa "MyRSAKey" "NT Authority\Network service"
现在我想使用这个关键,我需要把它添加到web.config文件
<configProtectedData defaultProvider="MyProviderName">
<providers>
<add
name="MyProviderName"
type="System.Configuration.RsaProtectedConfigurationProvider, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
keyContainerName="MyRSAKey"
useMachineContainer="true" />
</providers>
现在,当我运行此命令时,它的工作原理:
aspnet_regiis -pef "sectiomName" "pathToConfigFile" -prov "MyProviderName"
问题是,无论keyContainerName具有什么样的值,它都能正常工作。或者甚至当我将keyContainerName从配置文件中完全取出时,它仍然有效,表明它实际上并未使用我生成并安装的密钥。
另外visual studio 2010甚至不认识keyContainerName(或useMachineContainer),说'keyContainerName'的名字是不允许的。
这是怎么回事?
为什么使用[多个感叹号](http://wiki.lspace.org/wiki/Multiple_exclamation_marks)? – 2011-02-08 15:24:14