/// <summary> /// The given cert should always be accepted for the given hostname:port, /// regardless of errors verifying the cert. /// Host:Port is a primary key, only one entry per host:port can exist. /// </summary> /// <param name="url"></param> /// <param name="cert">The cert that should always be accepted</param> /// <param name="flags">The errors we want to be overriden.</param> public void RememberValidityOverride(Uri url, Certificate cert, CertOverride flags, bool temporary) { if (url == null) { throw new ArgumentNullException("url"); } if (cert == null) { throw new ArgumentNullException("cert"); } var mapping = new System.Globalization.IdnMapping(); using (var aHostName = new nsACString(mapping.GetAscii(url.Host))) { Instance.RememberValidityOverride(aHostName, url.Port, cert._cert.Instance, (uint)flags, temporary); } }
public bool RememberRecentBadCert(Uri url, SSLStatus sslStatus) { if (url == null) { throw new ArgumentNullException("url"); } if (sslStatus == null) { throw new ArgumentNullException("sslStatus"); } Certificate cert = sslStatus.ServerCert; if (HasMatchingOverride(url, cert)) { return(false); } CertOverride flags = 0; if (sslStatus.IsUntrusted) { flags |= CertOverride.Untrusted; } if (sslStatus.IsDomainMismatch) { flags |= CertOverride.Mismatch; } if (sslStatus.IsNotValidAtThisTime) { flags |= CertOverride.Time; } RememberValidityOverride(url, cert, flags, true); return(true); }