Can't find cert in local store
I have installed an x509 cert following these directions; http://www.vandyke.com/products/vshell/docs/windows/Use_X.509_Certificates.htm This istalls it into the tru开发者_JAVA百科sted root certification authorities store, AuthRoot. When trying to find the cert; open the store:X509Store store = new X509Store(StoreName.AuthRoot) loop through, find one with X thumbprint. This works fine when it is installed into the trusted root cert auth store.
When I try to do the same but install it into the personal store, change opening the store to X509Store store = new X509Store(StoreName.My) I can not find the cert.
Looking in the certmgr I can see it under personal->certificates.
Is there configuration required in IIS7 for personal cert? Could anyone help explain what I'm missing?
It's StoreName.Root, not StoreName.AuthRoot, for Trusted Root Certification Authorities.
For the personal store, you have to use the X509Store constructor with the StoreLocation parameter to use the Local Computer, Personal store, otherwise you are searching in the Current User, Personal store.
Try:
var store = new X509Store(StoreName.My, StoreLocation.LocalMachine);
精彩评论