Check revoked certificates by default

Set ServicePointManager.CheckCertificateRevocationList to true in the
WebRequestHelper to enable revoked certificates by default. This is
a no-op on mono:

c5b88ec4f3/mcs/class/System/System.Net/ServicePointManager.cs (L197)

On macOS, mono will use native APIs so a revoked certificate will
have SslPolicyErrors.
This commit is contained in:
Matt Ward 2023-08-22 12:35:54 +01:00 коммит произвёл Matt Ward
Родитель 3e7db3d8fd
Коммит 8eccfa0f96
1 изменённых файлов: 8 добавлений и 0 удалений

Просмотреть файл

@ -37,6 +37,14 @@ namespace Mono.Addins.Setup
{
static Func<Func<HttpWebRequest>, Action<HttpWebRequest>,CancellationToken,HttpWebResponse> _handler;
static WebRequestHelper()
{
// Online certificate revocation check is not supported on Mono:
// https://github.com/mono/mono/blob/c5b88ec4f323f2bdb7c7d0a595ece28dae66579c/mcs/class/System/System.Net/ServicePointManager.cs#L197
// However on macOS Mono uses native APIs so a revoked certificate will have SslPolicyErrors.
ServicePointManager.CheckCertificateRevocationList = true;
}
/// <summary>
/// Sets a custom request handler that can handle requests for authenticated proxy servers.
/// </summary>