I have a universal Windows Store / Phone application that will store certificates. I have no problem uploading certificates to the CertificateStore application and using them. But when it comes to removing them, I have a problem.
For example, the following code is great for finding my certificate in a Windows Store environment:
async Task<Certificate> FindMyCert()
{
var query = new CertificateQuery();
query.FriendlyName = "mytestcert";
var certificates = await CertificateStores.FindAllAsync(query);
if (certificates.Count != 1)
{
return null;
}
return certificates[0];
}
Now, let's say I want to remove this certificate from the store. The only "Delete" that I know of is in the CertificateStore object. Therefore, I need to get the certificate store, and then do the deletion:
var s = CertificateStores.GetStoreByName("MY");
if (s != null)
s.Delete(c);
Assert.IsNull(await FindMyCert());
There is only one problem. If you look at the documentation for GetStoreName 1 , it says that the name of the certificate store cannot be "MY".
, , . , - . .
!