| | | 1 | | // Licensed to the .NET Foundation under one or more agreements. |
| | | 2 | | // The .NET Foundation licenses this file to you under the MIT license. |
| | | 3 | | |
| | | 4 | | using System.Diagnostics.CodeAnalysis; |
| | | 5 | | using System.Runtime.CompilerServices; |
| | | 6 | | using System.Runtime.InteropServices; |
| | | 7 | | |
| | | 8 | | namespace System |
| | | 9 | | { |
| | | 10 | | internal static partial class LocalAppContextSwitches |
| | | 11 | | { |
| | | 12 | | private static int s_disableTlsResume; |
| | | 13 | | internal static bool DisableTlsResume |
| | | 14 | | { |
| | | 15 | | [MethodImpl(MethodImplOptions.AggressiveInlining)] |
| | 0 | 16 | | get => GetCachedSwitchValue("System.Net.Security.DisableTlsResume", "DOTNET_SYSTEM_NET_SECURITY_DISABLETLSRE |
| | | 17 | | } |
| | | 18 | | |
| | | 19 | | // By default the peer certificate is not re-validated on a resumed (abbreviated) TLS |
| | | 20 | | // handshake, matching the behavior of common TLS stacks (e.g. OpenSSL, SChannel) that |
| | | 21 | | // do not re-run certificate verification when a session is resumed. This optimization |
| | | 22 | | // only applies on platforms where session resumption can be detected (currently Windows |
| | | 23 | | // and Linux); elsewhere the peer certificate is always re-validated. Enabling this |
| | | 24 | | // switch restores the previous behavior of re-validating the peer certificate (running |
| | | 25 | | // the chain build and the user validation callback) on every successful resumption. |
| | | 26 | | private static int s_revalidateCertificateOnTlsResume; |
| | | 27 | | internal static bool RevalidateCertificateOnTlsResume |
| | | 28 | | { |
| | | 29 | | [MethodImpl(MethodImplOptions.AggressiveInlining)] |
| | 0 | 30 | | get => GetCachedSwitchValue("System.Net.Security.RevalidateCertificateOnTlsResume", "DOTNET_SYSTEM_NET_SECUR |
| | | 31 | | } |
| | | 32 | | |
| | | 33 | | private static int s_captureClientHello; |
| | | 34 | | internal static bool CaptureClientHello |
| | | 35 | | { |
| | | 36 | | [MethodImpl(MethodImplOptions.AggressiveInlining)] |
| | | 37 | | get => GetCachedSwitchValue("System.Net.Security.CaptureClientHello", "DOTNET_SYSTEM_NET_SECURITY_CAPTURECLI |
| | | 38 | | } |
| | | 39 | | |
| | | 40 | | private static int s_enableServerAiaDownloads; |
| | | 41 | | internal static bool EnableServerAiaDownloads |
| | | 42 | | { |
| | | 43 | | [MethodImpl(MethodImplOptions.AggressiveInlining)] |
| | 0 | 44 | | get => GetCachedSwitchValue("System.Net.Security.EnableServerAiaDownloads", "DOTNET_SYSTEM_NET_SECURITY_ENAB |
| | | 45 | | } |
| | | 46 | | |
| | | 47 | | private static int s_enableOcspStapling; |
| | | 48 | | internal static bool EnableOcspStapling |
| | | 49 | | { |
| | | 50 | | [MethodImpl(MethodImplOptions.AggressiveInlining)] |
| | 0 | 51 | | get => GetCachedSwitchValue("System.Net.Security.EnableServerOcspStaplingFromOnlyCertificateOnLinux", ref s_ |
| | | 52 | | } |
| | | 53 | | |
| | | 54 | | private static int s_useLegacySslStreamHandshake; |
| | | 55 | | internal static bool UseLegacySslStreamHandshake |
| | | 56 | | { |
| | | 57 | | [MethodImpl(MethodImplOptions.AggressiveInlining)] |
| | 0 | 58 | | get => GetCachedSwitchValue("System.Net.Security.UseLegacySslStreamHandshake", "DOTNET_SYSTEM_NET_SECURITY_U |
| | | 59 | | } |
| | | 60 | | |
| | | 61 | | #if !TARGET_WINDOWS |
| | | 62 | | private static int s_useManagedNtlm; |
| | | 63 | | [FeatureSwitchDefinition("System.Net.Security.UseManagedNtlm")] |
| | | 64 | | internal static bool UseManagedNtlm |
| | | 65 | | { |
| | | 66 | | [MethodImpl(MethodImplOptions.AggressiveInlining)] |
| | | 67 | | get => GetCachedSwitchValue("System.Net.Security.UseManagedNtlm", ref s_useManagedNtlm, |
| | | 68 | | defaultValue: OperatingSystem.IsMacOS() || OperatingSystem.IsIOS() || OperatingSystem.IsMacCatalyst() || |
| | | 69 | | (OperatingSystem.IsLinux() && RuntimeInformation.RuntimeIdentifier.StartsWith("linux-bionic-", StringCom |
| | | 70 | | } |
| | | 71 | | #endif |
| | | 72 | | |
| | | 73 | | #if TARGET_APPLE |
| | | 74 | | private static int s_useNetworkFramework; |
| | | 75 | | internal static bool UseNetworkFramework |
| | | 76 | | { |
| | | 77 | | [MethodImpl(MethodImplOptions.AggressiveInlining)] |
| | | 78 | | get => GetCachedSwitchValue("System.Net.Security.UseNetworkFramework", "DOTNET_SYSTEM_NET_SECURITY_USENETWOR |
| | | 79 | | } |
| | | 80 | | #endif |
| | | 81 | | } |
| | | 82 | | } |
| | | 83 | | |