无法打开 RSA 密钥容器 [英] The RSA key container could not be opened

查看:31
本文介绍了无法打开 RSA 密钥容器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在运行 XP home 的旧机器上开发 ASP.NET 站点.我最近买了一台新的 Win 7 PC,并将我所有的项目文件移到了另一端.当我尝试运行该项目时,收到此错误消息:

I've been developing an ASP.NET site on an older machine running XP home. I recently got a new Win 7 PC and moved all my project files across. When I try and run the project, I get this error message:

无法使用提供程序‘MyRsaProtectedConfigurationProvider’解密.来自提供程序的错误消息:无法打开 RSA 密钥容器."

我意识到我使用 RSA 加密 加密了部分 web.config 文件.这就是现在的问题所在.我不确定如何让该键再次工作,以便我可以在我的新机器上使用它.我从旧机器上导出密钥并使用:

I realised that I encrypted parts of my web.config file using a RSA encryption. This is where the problem now lies. I'm not sure how to get that key working again so that I can use it on my new machine. I exported the key from the older machine and imported it using:

aspnet_regiis -pi "RSAProviderName" "C:RSA_configkey.xml"

这已成功导入.然后我运行了该项目,但出现了相同的错误消息.我想这可能是一个许可问题,所以我跑了:

This was imported successfully. I then ran the project, but the same error message came up. I figured it might be a permission thing, so I ran:

aspnet_regiis -pa "RSAProviderName" "Desktop" -full

这也成功了,但我仍然收到错误消息.通过阅读,我看到人们使用ASPNET"而不是Desktop"(Desktop 是我的机器名称).但是,当我尝试使用ASPNET"时,我得到:

This was also successful, but I still get the error. From reading around, I've seen people use "ASPNET" instead of "Desktop" (Desktop is my machine name). However, when I try and use "ASPNET", I get:

未完成帐户名称和安全 ID 之间的映射.<来自 HRESULT 的异常 = 0x80070534

在修复此问题之前我无法处理该项目,因此非常感谢任何帮助.谢谢!

I can't work on the project until this is fixed, so any help is much appreciated. Thanks!

推荐答案

如果您仍然可以访问旧机器,您可以随时解密该机器上的配置部分,然后将未加密的配置文件复制到新机器(和,如有必要,在旧机器上重新加密文件).

If you still have access to the older machine, you could always decrypt the configuration section on that machine, then copy the unencrypted config file to the new machine (and, if necessary, re-encrypt the file on the old machine).

在 Windows 7 上,默认情况下运行 IIS 应用程序池的帐户可能是 ApplicationPoolIdentity(相对于 ASPNET).要授予权限,请尝试以下操作:

On Windows 7, the account under which your IIS application pools run by default will likely be ApplicationPoolIdentity (as opposed to ASPNET). To grant permissions, try this:

aspnet_regiis -pa RSAProviderName "IIS APPPOOLDefaultAppPool" -full

顺便说一句,如果您决定坚持将密钥从旧机器复制到新机器,您应该确保在导出时也导出私钥数据:

By the way, if you do decide to persevere with copying the key from the old machine to the new one, you should make sure that, when exporting, you export the private key data too:

aspnet_regiis -px RSAProviderName C:RSA_configkey.xml -pri

并且,可选地,在导入期间使关键数据可导出:

And, optionally, to make the key data exportable during the import:

aspnet_regiis -pi RSAProviderName C:RSA_configkey.xml -exp

这篇关于无法打开 RSA 密钥容器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆