SslStream improvements and tests
commit7277e3bb5ee3dbec669ca70634291fcc186e25cc
authorMartin Baulig <mabaul@microsoft.com>
Thu, 7 Feb 2019 23:43:01 +0000 (7 18:43 -0500)
committerMarek Safar <marek.safar@gmail.com>
Thu, 21 Feb 2019 19:43:25 +0000 (21 20:43 +0100)
tree95dc8d38fbb6f3a8f5c92a07b0c9071a6e46658f
parentaa047137232f1896554ae808eaf1a385fc59e830
SslStream improvements and tests

* Add server-side Server-Name-Indication (SNI) support (both AppleTls and BTLS).

* Support the new `SslServerAuthenticationOptions.ServerCertificateSelectionCallback`.

* Server certificate selection is now compatible with CoreFx behavior; first
  checking the new `ServerCertSelectionDelegate` then `LocalCertSelectionCallback`
  and finally using an explicitly provided certificate.

* Misc exception checks and fixes to make behavior consistent with CoreFx;
  any exception thrown by reading / writing the underlying stream will now be
  propagated verbatim (and not wrapped in an `AuthenticationException`);
  exceptions thrown by the handshake / TLS stack itself will still be wrapped.

* Added `System.Net.Security` xUnit tests from CoreFx.

* Misc test cleanups; moved certificate test files from `System.Net.Http` into
  `System` and embed them in the test assembly as resources, adjusting
  `test-helpers/Configuration.Certificates.cs` accordingly.
32 files changed:
external/corefx
mcs/class/System.Net.Http/FunctionalTests/Makefile
mcs/class/System.Net.Http/FunctionalTests/functional-tests.sources
mcs/class/System.Net.Http/Makefile
mcs/class/System.Net.Http/UnitTests/unit-tests.sources
mcs/class/System.Net.Http/corefx/PlatformDetection.cs
mcs/class/System/Makefile
mcs/class/System/Mono.AppleTls/AppleTlsContext.cs
mcs/class/System/Mono.AppleTls/SecureTransport.cs
mcs/class/System/Mono.Btls/MonoBtlsContext.cs
mcs/class/System/Mono.Btls/MonoBtlsObject.cs
mcs/class/System/Mono.Btls/MonoBtlsSsl.cs
mcs/class/System/Mono.Btls/MonoBtlsSslCtx.cs
mcs/class/System/Mono.Net.Security/AsyncProtocolRequest.cs
mcs/class/System/Mono.Net.Security/MobileAuthenticatedStream.cs
mcs/class/System/Mono.Net.Security/MobileTlsContext.cs
mcs/class/System/Mono.Net.Security/MonoSslAuthenticationOptions.cs
mcs/class/System/System.Net.Security/SslStream.cs
mcs/class/System/System_xtest.dll.sources
mcs/class/System/Test/TestData/testclienteku.contoso.com.pfx [new file with mode: 0644]
mcs/class/System/Test/TestData/testnoeku.contoso.com.pfx [new file with mode: 0644]
mcs/class/System/Test/TestData/testselfsignedservereku.contoso.com.pfx [new file with mode: 0644]
mcs/class/System/Test/TestData/testservereku.contoso.com.pfx [moved from mcs/class/System.Net.Http/TestData/testservereku.contoso.com.pfx with 100% similarity]
mcs/class/System/monotouch_watch_System_xtest.dll.exclude.sources
mcs/class/System/win32_net_4_x_System_xtest.dll.exclude.sources [new file with mode: 0644]
mcs/class/test-helpers/Configuration.Certificates.cs [moved from mcs/class/System.Net.Http/corefx/Configuration.Certificates.cs with 98% similarity]
mcs/class/test-helpers/Configuration.Http.cs [moved from mcs/class/System.Net.Http/corefx/Configuration.Http.cs with 62% similarity]
mcs/class/test-helpers/PlatformDetection.cs
mcs/class/test-helpers/TestConfiguration.cs [new file with mode: 0644]
mono/btls/btls-ssl-ctx.c
mono/btls/btls-ssl-ctx.h
scripts/ci/run-jenkins.sh