title: Unity - Unable to send HTTPS request due to CryptographicException
body: <p>I'm trying to send an <strong>https</strong> request to my remote server but I'm always getting the following exception:</p>
  
  <pre><code>Exception: System.IO.IOException: The authentication or decryption has failed. ---&gt; System.ArgumentException: certificate ---&gt; 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 &lt;filename unknown&gt;:0 
    at Mono.Security.X509.X509Certificate.VerifySignature (System.Security.Cryptography.AsymmetricAlgorithm aa) [0x00000] in &lt;filename unknown&gt;:0 
    at System.Security.Cryptography.X509Certificates.X509Chain.IsSignedWith (System.Security.Cryptography.X509Certificates.X509Certificate2 signed, System.Security.Cryptography.AsymmetricAlgorithm pubkey) [0x00000] in &lt;filename unknown&gt;:0 
    at System.Security.Cryptography.X509Certificates.X509Chain.Process (Int32 n) [0x00000] in &lt;filename unknown&gt;:0 
    at System.Security.Cryptography.X509Certificates.X509Chain.ValidateChain (X509ChainStatusFlags flag) [0x00000] in &lt;filename unknown&gt;:0 
    at System.Security.Cryptography.X509Certificates.X509Chain.Build (System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) [0x00000] in &lt;filename unknown&gt;:0 
    --- End of inner exception stack trace ---
    at System.Security.Cryptography.X509Certificates.X509Chain.Build (System.Security.Cryptography.X509Certificates.X509Certificate2 certificate) [0x00000] in &lt;filename unknown&gt;:0 
    at System.Net.Security.SslStream+&lt;BeginAuthenticateAsClient&gt;c__AnonStorey7.&lt;&gt;m__A (System.Security.Cryptography.X509Certificates.X509Certificate cert, System.Int32[] certErrors) [0x00000] in &lt;filename unknown&gt;:0 
    at Mono.Security.Protocol.Tls.SslClientStream.OnRemoteCertificateValidation (System.Security.Cryptography.X509Certificates.X509Certificate certificate, System.Int32[] errors) [0x00000] in &lt;filename unknown&gt;:0 
    at Mono.Security.Protocol.Tls.SslStreamBase.RaiseRemoteCertificateValidation (System.Security.Cryptography.X509Certificates.X509Certificate certificate, System.Int32[] errors) [0x00000] in &lt;filename unknown&gt;:0 
    at Mono.Security.Protocol.Tls.SslClientStream.RaiseServerCertificateValidation (System.Security.Cryptography.X509Certificates.X509Certificate certificate, System.Int32[] certificateErrors) [0x00000] in &lt;filename unknown&gt;:0 
    at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.validateCertificates (Mono.Security.X509.X509CertificateCollection certificates) [0x00000] in &lt;filename unknown&gt;:0 
    at Mono.Security.Protocol.Tls.Handshake.Client.TlsServerCertificate.ProcessAsTls1 () [0x00000] in &lt;filename unknown&gt;:0 
    at Mono.Security.Protocol.Tls.Handshake.HandshakeMessage.Process () [0x00000] in &lt;filename unknown&gt;:0 
    at (wrapper remoting-invoke-with-check) Mono.Security.Protocol.Tls.Handshake.HandshakeMessage:Process ()
    at Mono.Security.Protocol.Tls.ClientRecordProtocol.ProcessHandshakeMessage (Mono.Security.Protocol.Tls.TlsStream handMsg) [0x00000] in &lt;filename unknown&gt;:0 
    at Mono.Security.Protocol.Tls.RecordProtocol.InternalReceiveRecordCallback (IAsyncResult asyncResult) [0x00000] in &lt;filename unknown&gt;:0 
    --- End of inner exception stack trace ---
    at Mono.Security.Protocol.Tls.SslStreamBase.AsyncHandshakeCallback (IAsyncResult asyncResult) [0x00000] in &lt;filename unknown&gt;:0 
  </code></pre>
  
  <p>At first I thought it was a Certificate validation issue, so I added the following code before sending the request:</p>
  
  <pre><code>ServicePointManager.ServerCertificateValidationCallback = (sender, cert, chain, ssl) =&gt; true;
  </code></pre>
  
  <p>Turns out that the <code>ServerCertificateValidationCallback</code> wasn't even being invoked and <a href="https://stackoverflow.com/a/6956759">the exception was related to 'Plain SSL' or 'SSL ciphers'</a>.</p>
  
  <p>Note that my remote server URL is <code>https://_my_app_.herokuapp.com/_path_</code>. 
  Strangely enough, if I change the URL to any other <strong>https</strong> server such as <code>https://www.google.com</code> or <code>https://www.facebook.com</code> I don't get the Exception and the request succeeds.</p>
  
  <p>Looks like the Mono implementation used by Unity does not support heroku's cipher suites (I can guarantee that because I recently developed a MonoTouch application that was able to connect to the same server).</p>
  
  <p>Is it a client or server issue? Should I add some hacky code on the client side or should the server's configuration be changed?</p>