Bug 57519 - SslStream CipherAlgorithm/CipherStrength properties throws
Summary: SslStream CipherAlgorithm/CipherStrength properties throws
Alias: None
Product: Class Libraries
Classification: Mono
Component: Mono.Security ()
Version: 5.0 (2017-02)
Hardware: PC Linux
: --- enhancement
Target Milestone: Future Release
Assignee: Bugzilla
Depends on:
Reported: 2017-06-15 11:08 UTC by Peter Nelson
Modified: 2017-09-12 16:25 UTC (History)
3 users (show)

Is this bug a regression?: Yes
Last known good build: pre-5.0 builds

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 57519 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:

Description Peter Nelson 2017-06-15 11:08:07 UTC
I am using prebuilt Mono JIT compiler version (2017-02/5077205 Thu May 25 09:19:47 UTC 2017).

When using btls, the SslStream properties CipherAlgorithm, HashAlgorithm, and KeyExchangeAlgorithm all have the value None. Trying to use CipherStrength, HashStrength, or KeyExchangeStrength results in a System.NotImplementedException.

$ ./Test.exe www.google.com
SslProtocol: Tls
CipherAlgorithm: None
HashAlgorithm: None
KeyExchangeAlgorithm: None

Unhandled Exception:
System.NotImplementedException: The method or operation is not implemented.
  at Mono.Net.Security.MobileAuthenticatedStream.get_CipherStrength () [0x00000] in <2b0d86369d72459baed0cee98a8e578a>:0 
  at System.Net.Security.SslStream.get_CipherStrength () [0x00006] in <2b0d86369d72459baed0cee98a8e578a>:0 
  at TestScript.MainClass.Main (System.String[] args) [0x0009c] in <7a8e701e41324f6b8a45491d732e6784>:0 

When using MONO_TLS_PROVIDER=legacy, these properties are all filled and work as expected:

$ MONO_TLS_PROVIDER=legacy ./Test.exe www.google.com
SslProtocol: Tls
CipherAlgorithm: Aes128
HashAlgorithm: Sha1
KeyExchangeAlgorithm: RsaKeyX
CipherStrength: 128
HashStrength: 160
KeyExchangeStrength: 2048

Below is my test case code:

class MainClass
	public static void Main(string[] args)
		var t = new TcpClient();
		t.Connect(args[0], 443);
		var s = t.GetStream();
		var ssl = new SslStream(s, false);
		ssl.AuthenticateAsClient(args[0], null, System.Security.Authentication.SslProtocols.Tls, false);

		Console.WriteLine("SslProtocol: " + ssl.SslProtocol);
		Console.WriteLine("CipherAlgorithm: " + ssl.CipherAlgorithm);
		Console.WriteLine("HashAlgorithm: " + ssl.HashAlgorithm);
		Console.WriteLine("KeyExchangeAlgorithm: " + ssl.KeyExchangeAlgorithm);
		Console.WriteLine("CipherStrength: " + ssl.CipherStrength);
		Console.WriteLine("HashStrength: " + ssl.HashStrength);
		Console.WriteLine("KeyExchangeStrength: " + ssl.KeyExchangeStrength);