Warning
Serious problems might occur if you modify the registry incorrectly by using Registry Editor or by using another method. These problems might require that you reinstall the operating system. Microsoft cannot guarantee that these problems can be solved. Modify the registry at your own risk.
Enhanced Key Usage (EKU) is described in RFC 5280 in section 4.2.1.12: This extension indicates one or more purposes for which the certified public key may be used, in addition to or in place of the basic purposes that are indicated in the key usage extension. For example, a certificate that’s used for the authentication of a client to a server must be configured for Client Authentication. Similarly, a certificate that’s used for the authentication of a server must be configured for Server Authentication.
When certificates are used for authentication, the authenticator examines the client certificate and seeks the correct purpose object identifier in Application Policies extensions. For example, the object identifier for Client Authentication is 1.3.6.1.5.5.7.3.2. When a certificate is used for client authentication, this object identifier must be present in the EKU extensions of the certificate or authentication fails. Certificates that have no EKU extension continue to authenticate correctly.
If you temporarily can’t access correctly reissued certificates, you can choose to opt in or out of the security change across all computer operations to avoid any connectivity effects. To do this, specify the following registry key settings, depending on which .NET Framework version your application is targeting.
Method 1: Updating registry key (available for all versions)
Note This registry entry must be a DWORD entry.
You can also opt out on a per-application basis. The following options are available for disabling this change to make sure that application compatibility is maintained.
Method 2: Disable the policy for individual applications
Note This registry entry must be a DWORD entry. The only valid value is 0. Any other value is ignored.
Method 3: Using configuration API (available for the .NET Framework 4.6 and later versions)
Starting in the .NET Framework 4.6, you can change the configuration at an application level through code, an application configuration, or registry changes.
Configuring the switch in the .NET Framework 4.6
Note The following examples disable the security feature. Note By default, Switch.System.Net.DontCheckCertificateEKUsName = True for all .NET Framework 4.x applications that are running on the .NET Framework 4.6 and later versions.
- For 32-bit process on 32-bit system and 64-bit process on 64-bit system:
HKEY_LOCAL_MACHINE\Software\Microsoft\.NETFramework\v4.0.30319@RequireCertificateEKUs=0
- For 32-bit process on 64-bit system:
HKEY_LOCAL_MACHINE \Software\Wow6432Node\Microsoft\.NETFramework\v4.0.30319@RequireCertificateEKUs=0
- For 32-bit process on 32-bit system and 64-bit process on 64-bit system:
HKEY_LOCAL_MACHINE\Software\Microsoft\.NETFramework\v4.0.30319@System.Net.ServicePointManager.RequireCertificateEKUs
S:\Prj\console_pg\console_pg45\bin\Release\console_pg45.exe=0
C:\MyApp\MyApp.exe=0
- For 32-bit process on 64-bit system:
HKEY_LOCAL_MACHINE \Software\Wow6432Node\Microsoft\.NETFramework\v4.0.30319@System.Net.ServicePointManager.RequireCertificateEKUs
S:\Prj\console_pg\console_pg45\bin\Release\console_pg45.exe=0
C:\MyApp\MyApp.exe=0
- Programmatically
The first thing that the application should do is to run the following code. This is because Service Point Manager initializes only one time.
private const string DisableCachingName = @"TestSwitch.LocalAppContext.DisableCaching";
private const string DontCheckCertificateEKUsName= @"Switch.System.Net.DontCheckCertificateEKUs";
AppContext.SetSwitch(DisableCachingName, true);
AppContext.SetSwitch(DontCheckCertificateEKUsName, true);
- Application configuration
To change the application configuration, add the following entry:
<runtime>
<AppContextSwitchOverrides value="Switch.System.Net.DontCheckCertificateEKUsName=true"/>
</runtime>
- Registry key (machine global):
Registry location: HKEY_LOCAL_MACHINE\Software\[Wow6432Node\]Microsoft\.NETFramework\AppContext\Switch.System.Net.DontCheckCertificateEKUsName
Type: String
Value: "true"
-
For more information about this security update as it relates to Windows Server 2012, see the following article in the Microsoft Knowledge Base:
4019113 Security and Quality Rollup for the .NET Framework 3.5 Service Pack 1, 4.5.2, 4.6, 4.6.1, and 4.6.2 updates for Windows Server 2012: May 9, 2017