Need to install certificate every day

0 投票
最新提问 用户: (120 分)

I will be honest and let you know that I don麓t know a whole lot what I am talking about.

I am using a soap service that requires that I have a certificate installed. Everything works fine except that from time to time all of a sudden my code does not find the required certificate and I have to read it in again and then everything starts working again.

here is the code I use to retrieve the certificate.

X509Store store = new X509Store(StoreName.My, StoreLocation.LocalMachine);    
store.Open(OpenFlags.ReadOnly);
foreach(X509Certificate2 cert in store.Certificates)
{

if (cert != null && cert.Subject.Contains("my_cert"))
{
    token = new X509SecurityToken(cert);
    break;
}        
return token;

When I install in the certificate i right click -> Install pfx. Choose local machine.

Check the "Include all extended properties."

Check "Automatically select the certificate store based in the type of certificate"

Any help will be appreciated, thanks.

发表于 用户: (100 分)
Is this your private PC or a machine from your Company? Maybe the admin has some Policies that resets your store each restart.
发表于 用户: (120 分)
Its a company PC, and its just not one PC. there are 3 PC using this code and it happens on all of them, but this does not happen on my dev machine. I will check this out, thanks.

登录 或者 注册 后回答这个问题。

欢迎来到 Security Q&A ,有什么不懂的可以尽管在这里提问,你将会收到社区其他成员的回答。
...