Bug 60773 - SSLStream not calling RemoteCertificateValidationCallback on High Sierra
Summary: SSLStream not calling RemoteCertificateValidationCallback on High Sierra
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Security ()
Version: unspecified
Hardware: Macintosh Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2017-11-20 15:49 UTC by Daniel
Modified: 2017-11-20 15:49 UTC (History)
1 user (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report for Bug 60773 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:
Status:
NEW

Description Daniel 2017-11-20 15:49:00 UTC
This was not an issue on MacOS Sierra and didn't become an issue until High Sierra.

# Steps to reproduce
Using the library https://github.com/dsbenghe/Novell.Directory.Ldap.NETStandard/commits/master with a custom callback for SSL validation the validation never gets called.  
Specifically calling the following does not call the RemoteCertificateValidationCallback 
this.host = host;
this.port = port;
sock = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP);
var ipAddresses = Dns.GetHostAddressesAsync(host).Result;
var hostadd = ipAddresses.First(ip => ip.AddressFamily == AddressFamily.InterNetwork);
var ephost = new IPEndPoint(hostadd, port);
sock.Connect(ephost);
var nstream = new NetworkStream(sock, true);
try
{
    var sslstream = new SslStream(
        nstream,
        false,
        RemoteCertificateValidationCallback
    );
    sslstream.AuthenticateAsClient(host);
    sslstream.AuthenticateAsClientAsync(host).WaitAndUnwrap(connectionTimeout);
    in_Renamed = sslstream;
    out_Renamed = sslstream;
}
catch (Exception x)
{
}
# Expected behavior
The RemoteCertificateValidationCallback should be executed but it never gets called
# Actual behavior
This method never gets called
# Test environment (full version information)
This is on MacOS High Sierra.  This code executed as expected prior to High Sierra and it works correctly in .Net Core 1.1 and 2.0 on High Sierra.  
# StackTrace
"  at Mono.AppleTls.AppleTlsContext.CheckStatusAndThrow (Mono.AppleTls.SslStatus status, Mono.AppleTls.SslStatus[] acceptable) [0x00071] in /Library/Frameworks/Xamarin.Mac.framework/Versions/3.8.1.0/src/mono/mcs/class/System/Mono.AppleTls/AppleTlsContext.cs:124 \n  at Mono.AppleTls.AppleTlsContext.ProcessHandshake () [0x00026] in