对象已存在于RSACryptoServiceProvider中 [英] Object already exists in RSACryptoServiceProvider

查看:379
本文介绍了对象已存在于RSACryptoServiceProvider中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将源代码从一个应用程序复制到另一个应用程序,两者都在同一台机器上运行。我也在两个应用程序中使用与下面的containerName相同的字符串。

I copied the source code from one application to another, both running on the same machine. I am also using the same string for containerName below in both applications.

什么是阻止我的新应用程序读取保存在其他应用程序中的密钥?所有其他的事情是相等的,登录用户帐户等。

What is preventing my new application from reading the key that was saved in the other application? All other things are equal, logged in user account etc.

     CspParameters cspParams = new CspParameters();
     cspParams.KeyContainerName = containerName;
     cspParams.Flags = CspProviderFlags.UseMachineKeyStore;

     // Get error "object already exists" below.
     RSACryptoServiceProvider  rsaKey = new RSACryptoServiceProvider(cspParams);


推荐答案

您是否尝试向Everyone授予权限,例如,对于Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\Machine Keys中的文件,如下所述:

Did you try to grant permissions to Everyone, for example, for files in "Documents and Settings\All Users\Application Data\Microsoft\Crypto\RSA\Machine Keys", as it described there:

http://social.msdn。 microsoft.com/Forums/en/netfxbcl/thread/f7b9f928-a794-47f2-a5bd-9f64ca375040

这篇关于对象已存在于RSACryptoServiceProvider中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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