Search code examples
c#.netx509certificate2

X509certificate2 security warning


When i'm trying to add a new certificate to the X509Store there's a warning. There are thousands of certificates and the warning window ruins the automation

var store = new X509Store(StoreName.Root, StoreLocation.CurrentUser);
var someCert = new X509Certificate2();
store.Add(someCert);

How can i avoid this without changing my StoreName and StoreLocation settings ?


Solution

  • Simple answer: you cannot. Dialog popup call is hardcoded in Crypt32.dll.