CspParameters 对象已存在异常 解决多应用对同一容器的访问问题

 CspParameters cspParams; 
cspParams = new CspParameters(PROVIDER_RSA_FULL);
cspParams.KeyContainerName = "CONTAINER_NAME";
cspParams.Flags = CspProviderFlags.UseMachineKeyStore;
//cspParams.ProviderName =“Microsoft Strong Cryptographic Provider”;

CryptoKeyAccessRule rule = new CryptoKeyAccessRule(“everyone”,CryptoKeyRights.FullControl,AccessControlType.Allow);

cspParams.CryptoKeySecurity = new CryptoKeySecurity();
cspParams.CryptoKeySecurity.SetAccessRule(rule);
posted @ 2019-07-09 17:04  学而知之  阅读(382)  评论(0编辑  收藏  举报