static void RepairCert(string storeName, string sn, Action <string> log) { Process p = ProcessLauncher.LaunchProcess("certutil", "-repairstore " + storeName + " \"" + sn + "\"", (stdout) => log(stdout), (stderr) => log(stderr)); p.WaitForExit(); }
static void RemoveBinding(Action <string> log) { // netsh http delete sslcert ipport=0.0.0.0:443 Process p = ProcessLauncher.LaunchProcess("netsh", "http delete sslcert ipport=0.0.0.0:443", (stdout) => log(stdout), (stderr) => log(stderr)); p.WaitForExit(); }
static void AddNewBinding(string certHash, Guid appId, Action <string> log) { // netsh http add sslcert ipport=0.0.0.0:443 certstorename=Root certhash=[] appid={} // Why root? // https://stackoverflow.com/questions/13076915/ssl-certificate-add-failed-when-binding-to-port/19766650#19766650 (see Fredy Wenger's response) Process p = ProcessLauncher.LaunchProcess("netsh", "http add sslcert ipport=0.0.0.0:443 certstorename=Root certhash=" + certHash + " appid={" + appId.ToString() + "}", (stdout) => log(stdout), (stderr) => log(stderr)); p.WaitForExit(); }