【发布时间】:2014-04-27 07:28:38
【问题描述】:
我正在尝试加密 Web 应用的 web.config,但该应用存在于 2 个不同的环境(阶段、生产)中,每个环境都应使用不同的密钥容器。
所以我在我的舞台配置中使用了这个加密标头:
<configProtectedData defaultProvider="ApplicationProvider">
<providers>
<add name="ApplicationProvider"
type="System.Configuration.RsaProtectedConfigurationProvider, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
keyContainerName="ApplicationStageKeys"
useMachineContainer="true"
useOAEP="true"/>
</providers>
我的生产配置中的这个标题:
<configProtectedData defaultProvider="ApplicationProvider">
<providers>
<add name="ApplicationProvider"
type="System.Configuration.RsaProtectedConfigurationProvider, System.Configuration, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL"
keyContainerName="ApplicationProductionKeys"
useMachineContainer="true"
useOAEP="true"/>
</providers>
加密工作正常,但每次我尝试解密时,我都会收到以下错误,这让我无法想象......
C:\Windows\Microsoft.NET\Framework\v2.0.50727>aspnet_regiis -pdf connectionStrings C:\Temp
Decrypting configuration section...
Failed to decrypt using provider 'ApplicationProvider'. Error message from the provider: Bad Data.
(C:\Temp\web.config line 75)
Bad Data.
Failed!
我已经在每台服务器上导入了密钥并为两者都设置了 ACL,但仍然不满意,还有其他人遇到过这个问题吗?
【问题讨论】:
标签: asp.net web-applications encryption web-config rsa