Bug 15293 - System.Net.Security.SslStream on Mono crashes but works with .Net
Summary: System.Net.Security.SslStream on Mono crashes but works with .Net
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: System.Security ()
Version: 3.2.x
Hardware: PC Mac OS
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2013-10-09 05:23 UTC by Mike James
Modified: 2014-05-14 22:45 UTC (History)
6 users (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 on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Mike James 2013-10-09 05:23:02 UTC
It seems there is an issue in mono's implementation of System.Net.Security.SslStream, or some lower level, class. The app in question uses the WebSockets4Net library to make a web sockets connection. When using secure web socket connections over SSL, an exception is thrown. The WebSockets4Net library uses System.Net.Security.SslStream to do its work.
Comment 2 Zoltan Varga 2013-10-13 00:21:22 UTC
-> class libs.
Comment 3 Sebastien Pouliot 2014-03-04 09:10:21 UTC
Should be fixed with https://github.com/mono/mono/pull/929
Comment 4 Brendan Zagaeski (Xamarin Team, assistant) 2014-05-14 22:45:50 UTC
Adding the text from the pull request comment here to improve Bugzilla findability

--- From https://github.com/mono/mono/pull/929 ----

When reading and writing data at the same time over an System.Net.Security.SslStream, an exception will be thrown often.  Usually the exception is: Mono.Security.Protocol.Tls.TlsException "Bad record MAC"

The issue is that the single TlsCipherSuite instance used for both reading and writing does not synchronize access to the “header” member.  If the contents get corrupted the MAC calculation returned by ComputServerRecordMAC or ComputeClientRecordMAC is incorrect.

... Reproduced in OS X, iOS and Windows.