Skip to content

Commit 01b9a79

Browse files
committed
Remove SecurityProtocol.cs.
1 parent 7462c83 commit 01b9a79

File tree

14 files changed

+12
-67
lines changed

14 files changed

+12
-67
lines changed

src/libraries/Common/src/System/Net/SecurityProtocol.cs

-20
This file was deleted.

src/libraries/System.Net.Http.WinHttpHandler/src/System.Net.Http.WinHttpHandler.csproj

-2
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,6 @@ System.Net.Http.WinHttpHandler</PackageDescription>
6464
Link="Common\System\Net\HttpKnownHeaderNames.TryGetHeaderName.cs" />
6565
<Compile Include="$(CommonPath)System\Net\HttpStatusDescription.cs"
6666
Link="Common\System\Net\Http\HttpStatusDescription.cs" />
67-
<Compile Include="$(CommonPath)\System\Net\SecurityProtocol.cs"
68-
Link="Common\System\Net\SecurityProtocol.cs" />
6967
<Compile Include="$(CommonPath)\System\Net\UriScheme.cs"
7068
Link="Common\System\Net\UriScheme.cs" />
7169
<Compile Include="$(CommonPath)\System\Net\Http\HttpHandlerDefaults.cs"

src/libraries/System.Net.Http.WinHttpHandler/tests/UnitTests/System.Net.Http.WinHttpHandler.Unit.Tests.csproj

-2
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,6 @@
4040
Link="Common\System\Net\Logging\NetEventSource.Common.cs" />
4141
<Compile Include="$(CommonPath)System\Net\UriScheme.cs"
4242
Link="Common\System\Net\UriScheme.cs" />
43-
<Compile Include="$(CommonPath)System\Net\SecurityProtocol.cs"
44-
Link="Common\System\Net\SecurityProtocol.cs" />
4543
<Compile Include="$(CommonPath)System\Net\Http\HttpHandlerDefaults.cs"
4644
Link="Common\System\Net\Http\HttpHandlerDefaults.cs" />
4745
<Compile Include="$(CommonPath)\System\Net\Http\WinInetProxyHelper.cs"

src/libraries/System.Net.Http/src/System.Net.Http.csproj

-4
Original file line numberDiff line numberDiff line change
@@ -391,8 +391,6 @@
391391
Link="Common\System\Net\HttpKnownHeaderNames.cs" />
392392
<Compile Include="$(CommonPath)\System\Net\HttpKnownHeaderNames.TryGetHeaderName.cs"
393393
Link="Common\System\Net\HttpKnownHeaderNames.TryGetHeaderName.cs" />
394-
<Compile Include="$(CommonPath)\System\Net\SecurityProtocol.cs"
395-
Link="Common\System\Net\SecurityProtocol.cs" />
396394
<Compile Include="$(CommonPath)\System\Net\UriScheme.cs"
397395
Link="Common\System\Net\UriScheme.cs" />
398396
<Compile Include="$(CommonPath)\System\Net\Http\HttpHandlerDefaults.cs"
@@ -410,8 +408,6 @@
410408
<ItemGroup Condition="'$(TargetPlatformIdentifier)' != '' and '$(TargetPlatformIdentifier)' != 'windows' and '$(TargetPlatformIdentifier)' != 'browser' and '$(TargetPlatformIdentifier)' != 'wasi'">
411409
<Compile Include="$(CommonPath)System\StrongToWeakReference.cs"
412410
Link="Common\Interop\Unix\StrongToWeakReference.cs" />
413-
<Compile Include="$(CommonPath)System\Net\SecurityProtocol.cs"
414-
Link="Common\System\Net\SecurityProtocol.cs" />
415411
<Compile Include="$(CommonPath)System\Net\UriScheme.cs"
416412
Link="Common\System\Net\UriScheme.cs" />
417413
<Compile Include="$(CommonPath)Interop\Unix\Interop.Libraries.cs"

src/libraries/System.Net.Http/src/System/Net/Http/SocketsHttpHandler/ConnectionPool/HttpConnectionPool.cs

-15
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ internal sealed partial class HttpConnectionPool : IDisposable
2828
public const int DefaultHttpPort = 80;
2929
public const int DefaultHttpsPort = 443;
3030

31-
private static readonly bool s_isWindows7Or2008R2 = GetIsWindows7Or2008R2();
3231
private static readonly List<SslApplicationProtocol> s_http3ApplicationProtocols = new List<SslApplicationProtocol>() { SslApplicationProtocol.Http3 };
3332
private static readonly List<SslApplicationProtocol> s_http2ApplicationProtocols = new List<SslApplicationProtocol>() { SslApplicationProtocol.Http2, SslApplicationProtocol.Http11 };
3433
private static readonly List<SslApplicationProtocol> s_http2OnlyApplicationProtocols = new List<SslApplicationProtocol>() { SslApplicationProtocol.Http2 };
@@ -277,20 +276,6 @@ private static SslClientAuthenticationOptions ConstructSslOptions(HttpConnection
277276
// Set TargetHost for SNI
278277
sslOptions.TargetHost = sslHostName;
279278

280-
// Windows 7 and Windows 2008 R2 support TLS 1.1 and 1.2, but for legacy reasons by default those protocols
281-
// are not enabled when a developer elects to use the system default. However, in .NET Core 2.0 and earlier,
282-
// HttpClientHandler would enable them, due to being a wrapper for WinHTTP, which enabled them. Both for
283-
// compatibility and because we prefer those higher protocols whenever possible, SocketsHttpHandler also
284-
// pretends they're part of the default when running on Win7/2008R2.
285-
if (s_isWindows7Or2008R2 && sslOptions.EnabledSslProtocols == SslProtocols.None)
286-
{
287-
if (NetEventSource.Log.IsEnabled())
288-
{
289-
NetEventSource.Info(poolManager, $"Win7OrWin2K8R2 platform, Changing default TLS protocols to {SecurityProtocol.DefaultSecurityProtocols}");
290-
}
291-
sslOptions.EnabledSslProtocols = SecurityProtocol.DefaultSecurityProtocols;
292-
}
293-
294279
return sslOptions;
295280
}
296281

src/libraries/System.Net.Http/tests/UnitTests/System.Net.Http.Unit.Tests.csproj

-2
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,6 @@
3535
Link="ProductionCode\Common\System\Net\Logging\NetEventSource.Common.cs" />
3636
<Compile Include="$(CommonPath)System\Net\Logging\NetEventSource.Common.Associate.cs"
3737
Link="Common\System\Net\Logging\NetEventSource.Common.Associate.cs" />
38-
<Compile Include="$(CommonPath)System\Net\SecurityProtocol.cs"
39-
Link="ProductionCode\Common\System\Net\SecurityProtocol.cs" />
4038
<Compile Include="$(CommonPath)System\Net\UriScheme.cs"
4139
Link="ProductionCode\Common\System\Net\UriScheme.cs" />
4240
<Compile Include="$(CommonPath)System\Text\SimpleRegex.cs"

src/libraries/System.Net.Mail/src/System.Net.Mail.csproj

-2
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,6 @@
118118
Link="Common\System\Collections\Generic\BidirectionalDictionary.cs" />
119119
<Compile Include="$(CommonPath)System\NotImplemented.cs"
120120
Link="Common\System\NotImplemented.cs" />
121-
<Compile Include="$(CommonPath)System\Net\SecurityProtocol.cs"
122-
Link="Common\System\Net\SecurityProtocol.cs" />
123121
</ItemGroup>
124122

125123
<!-- Unix specific files -->

src/libraries/System.Net.Mail/tests/Unit/System.Net.Mail.Unit.Tests.csproj

-2
Original file line numberDiff line numberDiff line change
@@ -120,8 +120,6 @@
120120
Link="Common\System\Net\Logging\NetEventSource.Common.cs" />
121121
<Compile Include="$(CommonPath)System\Net\Logging\NetEventSource.Common.Associate.cs"
122122
Link="Common\System\Net\Logging\NetEventSource.Common.Associate.cs" />
123-
<Compile Include="$(CommonPath)System\Net\SecurityProtocol.cs"
124-
Link="Common\System\Net\SecurityProtocol.cs" />
125123
<Compile Include="$(CommonPath)System\Net\DebugSafeHandleZeroOrMinusOneIsInvalid.cs"
126124
Link="Common\System\Net\DebugSafeHandleZeroOrMinusOneIsInvalid.cs" />
127125
<Compile Include="$(CommonPath)System\Net\DebugSafeHandle.cs"

src/libraries/System.Net.Requests/src/System.Net.Requests.csproj

-2
Original file line numberDiff line numberDiff line change
@@ -81,8 +81,6 @@
8181
Link="Common\System\Net\ContextAwareResult.cs" />
8282
<Compile Include="$(CommonPath)System\Net\ExceptionCheck.cs"
8383
Link="Common\System\Net\ExceptionCheck.cs" />
84-
<Compile Include="$(CommonPath)System\Net\SecurityProtocol.cs"
85-
Link="Common\System\Net\SecurityProtocol.cs" />
8684
<Compile Include="$(CommonPath)System\NotImplemented.cs"
8785
Link="Common\System\NotImplemented.cs" />
8886
</ItemGroup>

src/libraries/System.Net.Security/src/System.Net.Security.csproj

-2
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,6 @@
9898
</Compile>
9999
<Compile Include="$(CommonPath)System\Net\ExceptionCheck.cs"
100100
Link="Common\System\Net\ExceptionCheck.cs" />
101-
<Compile Include="$(CommonPath)System\Net\SecurityProtocol.cs"
102-
Link="Common\System\Net\SecurityProtocol.cs" />
103101
<!-- Common -->
104102
<Compile Include="$(CommonPath)System\NotImplemented.cs"
105103
Link="Common\System\NotImplemented.cs" />

src/libraries/System.Net.Security/src/System/Net/Security/SslClientAuthenticationOptions.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public class SslClientAuthenticationOptions
1212
{
1313
private EncryptionPolicy _encryptionPolicy = EncryptionPolicy.RequireEncryption;
1414
private X509RevocationMode _checkCertificateRevocation = X509RevocationMode.NoCheck;
15-
private SslProtocols _enabledSslProtocols = SecurityProtocol.SystemDefaultSecurityProtocols;
15+
private SslProtocols _enabledSslProtocols = SslProtocols.None;
1616
private bool _allowRenegotiation = true;
1717
private bool _allowTlsResume = true;
1818

src/libraries/System.Net.Security/src/System/Net/Security/SslServerAuthenticationOptions.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ namespace System.Net.Security
1010
public class SslServerAuthenticationOptions
1111
{
1212
private X509RevocationMode _checkCertificateRevocation = X509RevocationMode.NoCheck;
13-
private SslProtocols _enabledSslProtocols = SecurityProtocol.SystemDefaultSecurityProtocols;
13+
private SslProtocols _enabledSslProtocols = SslProtocols.None;
1414
private EncryptionPolicy _encryptionPolicy = EncryptionPolicy.RequireEncryption;
1515
private bool _allowRenegotiation;
1616
private bool _allowTlsResume = true;

src/libraries/System.Net.Security/src/System/Net/Security/SslStream.cs

+10-10
Original file line numberDiff line numberDiff line change
@@ -228,14 +228,14 @@ public SslStream(Stream innerStream, bool leaveInnerStreamOpen, RemoteCertificat
228228
//
229229
public virtual IAsyncResult BeginAuthenticateAsClient(string targetHost, AsyncCallback? asyncCallback, object? asyncState)
230230
{
231-
return BeginAuthenticateAsClient(targetHost, null, SecurityProtocol.SystemDefaultSecurityProtocols, false,
231+
return BeginAuthenticateAsClient(targetHost, null, SslProtocols.None, false,
232232
asyncCallback, asyncState);
233233
}
234234

235235
public virtual IAsyncResult BeginAuthenticateAsClient(string targetHost, X509CertificateCollection? clientCertificates,
236236
bool checkCertificateRevocation, AsyncCallback? asyncCallback, object? asyncState)
237237
{
238-
return BeginAuthenticateAsClient(targetHost, clientCertificates, SecurityProtocol.SystemDefaultSecurityProtocols, checkCertificateRevocation, asyncCallback, asyncState);
238+
return BeginAuthenticateAsClient(targetHost, clientCertificates, SslProtocols.None, checkCertificateRevocation, asyncCallback, asyncState);
239239
}
240240

241241
public virtual IAsyncResult BeginAuthenticateAsClient(string targetHost, X509CertificateCollection? clientCertificates,
@@ -265,15 +265,15 @@ internal IAsyncResult BeginAuthenticateAsClient(SslClientAuthenticationOptions s
265265
public virtual IAsyncResult BeginAuthenticateAsServer(X509Certificate serverCertificate, AsyncCallback? asyncCallback, object? asyncState)
266266

267267
{
268-
return BeginAuthenticateAsServer(serverCertificate, false, SecurityProtocol.SystemDefaultSecurityProtocols, false,
268+
return BeginAuthenticateAsServer(serverCertificate, false, SslProtocols.None, false,
269269
asyncCallback,
270270
asyncState);
271271
}
272272

273273
public virtual IAsyncResult BeginAuthenticateAsServer(X509Certificate serverCertificate, bool clientCertificateRequired,
274274
bool checkCertificateRevocation, AsyncCallback? asyncCallback, object? asyncState)
275275
{
276-
return BeginAuthenticateAsServer(serverCertificate, clientCertificateRequired, SecurityProtocol.SystemDefaultSecurityProtocols, checkCertificateRevocation, asyncCallback, asyncState);
276+
return BeginAuthenticateAsServer(serverCertificate, clientCertificateRequired, SslProtocols.None, checkCertificateRevocation, asyncCallback, asyncState);
277277
}
278278

279279
public virtual IAsyncResult BeginAuthenticateAsServer(X509Certificate serverCertificate, bool clientCertificateRequired,
@@ -307,12 +307,12 @@ private IAsyncResult BeginAuthenticateAsServer(SslServerAuthenticationOptions ss
307307
#region Synchronous methods
308308
public virtual void AuthenticateAsClient(string targetHost)
309309
{
310-
AuthenticateAsClient(targetHost, null, SecurityProtocol.SystemDefaultSecurityProtocols, false);
310+
AuthenticateAsClient(targetHost, null, SslProtocols.None, false);
311311
}
312312

313313
public virtual void AuthenticateAsClient(string targetHost, X509CertificateCollection? clientCertificates, bool checkCertificateRevocation)
314314
{
315-
AuthenticateAsClient(targetHost, clientCertificates, SecurityProtocol.SystemDefaultSecurityProtocols, checkCertificateRevocation);
315+
AuthenticateAsClient(targetHost, clientCertificates, SslProtocols.None, checkCertificateRevocation);
316316
}
317317

318318
public virtual void AuthenticateAsClient(string targetHost, X509CertificateCollection? clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
@@ -341,12 +341,12 @@ public void AuthenticateAsClient(SslClientAuthenticationOptions sslClientAuthent
341341

342342
public virtual void AuthenticateAsServer(X509Certificate serverCertificate)
343343
{
344-
AuthenticateAsServer(serverCertificate, false, SecurityProtocol.SystemDefaultSecurityProtocols, false);
344+
AuthenticateAsServer(serverCertificate, false, SslProtocols.None, false);
345345
}
346346

347347
public virtual void AuthenticateAsServer(X509Certificate serverCertificate, bool clientCertificateRequired, bool checkCertificateRevocation)
348348
{
349-
AuthenticateAsServer(serverCertificate, clientCertificateRequired, SecurityProtocol.SystemDefaultSecurityProtocols, checkCertificateRevocation);
349+
AuthenticateAsServer(serverCertificate, clientCertificateRequired, SslProtocols.None, checkCertificateRevocation);
350350
}
351351

352352
public virtual void AuthenticateAsServer(X509Certificate serverCertificate, bool clientCertificateRequired, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
@@ -375,7 +375,7 @@ public void AuthenticateAsServer(SslServerAuthenticationOptions sslServerAuthent
375375
#region Task-based async public methods
376376
public virtual Task AuthenticateAsClientAsync(string targetHost) => AuthenticateAsClientAsync(targetHost, null, false);
377377

378-
public virtual Task AuthenticateAsClientAsync(string targetHost, X509CertificateCollection? clientCertificates, bool checkCertificateRevocation) => AuthenticateAsClientAsync(targetHost, clientCertificates, SecurityProtocol.SystemDefaultSecurityProtocols, checkCertificateRevocation);
378+
public virtual Task AuthenticateAsClientAsync(string targetHost, X509CertificateCollection? clientCertificates, bool checkCertificateRevocation) => AuthenticateAsClientAsync(targetHost, clientCertificates, SslProtocols.None, checkCertificateRevocation);
379379

380380
public virtual Task AuthenticateAsClientAsync(string targetHost, X509CertificateCollection? clientCertificates, SslProtocols enabledSslProtocols, bool checkCertificateRevocation)
381381
{
@@ -401,7 +401,7 @@ public Task AuthenticateAsClientAsync(SslClientAuthenticationOptions sslClientAu
401401
}
402402

403403
public virtual Task AuthenticateAsServerAsync(X509Certificate serverCertificate) =>
404-
AuthenticateAsServerAsync(serverCertificate, false, SecurityProtocol.SystemDefaultSecurityProtocols, false);
404+
AuthenticateAsServerAsync(serverCertificate, false, SslProtocols.None, false);
405405

406406
public virtual Task AuthenticateAsServerAsync(X509Certificate serverCertificate, bool clientCertificateRequired, bool checkCertificateRevocation)
407407
{

src/libraries/System.Net.Security/tests/UnitTests/System.Net.Security.Unit.Tests.csproj

-2
Original file line numberDiff line numberDiff line change
@@ -168,8 +168,6 @@
168168
Link="ProductionCode\System\Net\SslStreamContext.cs" />
169169
<Compile Include="..\..\src\System\Net\Security\SslCertificateTrust.cs"
170170
Link="ProductionCode\System\Net\Security\SslCertificateTrust.cs" />
171-
<Compile Include="$(CommonPath)System\Net\SecurityProtocol.cs"
172-
Link="ProductionCode\Common\System\Net\SecurityProtocol.cs" />
173171
<Compile Include="..\..\src\System\Net\Security\TlsAlertType.cs"
174172
Link="ProductionCode\Common\System\Net\TlsAlertType.cs" />
175173
<Compile Include="..\..\src\System\Net\Security\TlsFrameHelper.cs"

0 commit comments

Comments
 (0)