Hi,
I have code like this to enumerate certificates from user's personal
store:
X509Store personalStore = new X509Store(StoreName.My,
StoreLocation.CurrentUser);
personalStore.Open(OpenFlags.OpenExistingOnly |
OpenFlags.ReadOnly);
// read all certificates from personalStore.Certificates
To add or remove certificates from "My" store I invoke the shell's
certificate manager dialog using the API CryptUIDlgCertMgr of the
CRYPTUI.DLL
If I add new certificates to store using the CryptUIDlgCertMgr UI then
it is reflected in the collection that I get from X509Store. But if I
delete a certificate from same UI then it is still there in the
collection that I get from X509Store.
Any idea what I am missing here?
Thanks,
Sandeep
sandeepkg@gmail.com - 28 Dec 2006 09:33 GMT
Ok, I got the problem here. A CertificateAuthority type of certificate
with same name was also getting added while I was adding my certificate
to the personal store. This is not visible in shell certificate
dialog's personal store and hence always comes up in my code. Now I
filter my certificates based on the "Basic Constraints" key usage not
being of type certificate authority.
> Hi,
>
[quoted text clipped - 20 lines]
> Thanks,
> Sandeep