Bug 5645 - System.Security.Cryptography.CryptographicException when using System.Net.WebConnection
Summary: System.Security.Cryptography.CryptographicException when using System.Net.Web...
Alias: None
Product: Class Libraries
Classification: Mono
Component: Mono.Security ()
Version: unspecified
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2012-06-14 04:58 UTC by Lipperhey
Modified: 2012-08-14 13:28 UTC (History)
4 users (show)

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:

Description Lipperhey 2012-06-14 04:58:54 UTC
Our spider sometimes produces this error:

ERROR building certificate chain: System.ArgumentException: certificate ---> System.Security.Cryptography.CryptographicException: Unsupported hash algorithm: 1.2.840.113549.1.1.11
 at Mono.Security.X509.X509Certificate.VerifySignature (System.Security.Cryptography.RSA rsa) [0x00000] in <filename unknown>:0
 at Mono.Security.X509.X509Certificate.VerifySignature (System.Security.Cryptography.AsymmetricAlgorithm aa) [0x00000] in <filename unknown>:0
 at System.Security.Cryptography.X509Certificates.X509Chain.IsSignedWith (System.Security.Cryptography.X509Certificates.X509Certificate2 signed, System.Security.Cryptography.AsymmetricAlgorithm pubkey) [0x00000] in <filename unknown>:0
 at System.Security.Cryptography.X509Certificates.X509Chain.Process (Int32 n) [0x00000] in <filename unknown>:0
 at System.Security.Cryptography.X509Certificates.X509Chain.ValidateChain (X509ChainStatusFlags flag) [0x00000] in <filename unknown>:0
 at System.Security.Cryptography.X509Certificates.X509Chain.Build (System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) [0x00000] in <filename unknown>:0
 --- End of inner exception stack trace ---
 at System.Security.Cryptography.X509Certificates.X509Chain.Build (System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) [0x00000] in <filename unknown>:0
 at System.Net.ServicePointManager+ChainValidationHelper.ValidateChain (Mono.Security.X509.X509CertificateCollection certs) [0x00000] in <filename unknown>:0
Please, report this problem to the Mono team

Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object
 at System.Net.WebConnectionStream..ctor (System.Net.WebConnection cnc) [0x00000] in <filename unknown>:0
 at (wrapper remoting-invoke-with-check) System.Net.WebConnectionStream:.ctor (System.Net.WebConnection)
 at System.Net.WebConnection.ReadDone (IAsyncResult result) [0x00000] in <filename unknown>:0

We are running mono 2.10.6 on OpenSuSe 12.1. I cannot reproduce the error with particular websites, but it seems to happen several times a day. And it says "Please, report this problem to the Mono team", so here it is ;)
Comment 1 Zoltan Varga 2012-06-14 17:21:00 UTC
-> sys.web
Comment 2 Alex Corrado [MSFT] 2012-07-08 18:14:25 UTC
This appears to be fixed in mono master. It might be worth back porting to mono-2-10. As far as I can tell, the only commit we'd need is 21453a99ea73a7b248db3f30c1d11d18847e8936
Comment 3 Sebastien Pouliot 2012-08-14 13:28:29 UTC
This works with Mono 2.11 but this was not backported to Mono 2.10.
Patches are now backported for 2.10.11+