sta / sta/websocket-sharp

Problem with Chrome, Firefox works ok.

Open
#48 9 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
6.1k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

I just updated mono to 3.2.8 (Ubuntu 14.04 LTS)
I have this piece of code:

using System;
using WebSocketSharp;
using WebSocketSharp.Server;
using System.Security.Cryptography.X509Certificates;

namespace Example
{
public class Laputa : WebSocketService
{
protected override void OnMessage (MessageEventArgs e)
{
var msg = e.Data == "BALUS"
? "I've been balused already..."
: "I'm not available now.";

        Send (msg);
    }

    //protected override void OnMessage

}

public class MainClass
{
    public static void Main (string [] args)
    {
        string url = "wss://localhost:8182";
        var wssv = new WebSocketServer (url);
        wssv.AddWebSocketService<Laputa> ("/Laputa");
        wssv.Certificate = new X509Certificate2 ("/home/wss.pfx", "CertPass");

        url = "ws://localhost:8181";
        var ws = new WebSocketServer (url);
        ws.AddWebSocketService<Laputa> ("/Laputa");

        wssv.Start ();
        ws.Start ();

        Console.WriteLine ("Servers started... ");
        Console.ReadKey (true);
        wssv.Stop ();
        ws.Stop ();
    }
}

}

When i try to use ssl connection I got this:

c__AnonStorey0.<>m__0:487|System.IO.IOException: The authentication or decryption has failed. ---> System.NotSupportedException: Unsupported security protocol type
at Mono.Security.Protocol.Tls.Context.DecodeProtocolCode (Int16 code) [0x00024] in /opt/mono-3.x/mono-3.2.8/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/Context.cs:419
at Mono.Security.Protocol.Tls.Handshake.Server.TlsClientHello.processProtocol (Int16 protocol) [0x00000] in /opt/mono-3.x/mono-3.2.8/mcs/class/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientHello.cs:109
at Mono.Security.Protocol.Tls.Handshake.Server.TlsClientHello.ProcessAsTls1 () [0x00000] in /opt/mono-3.x/mono-3.2.8/mcs/class/Mono.Security/Mono.Security.Protocol.Tls.Handshake.Server/TlsClientHello.cs:76
at Mono.Security.Protocol.Tls.Handshake.HandshakeMessage.Process () [0x00037] in /opt/mono-3.x/mono-3.2.8/mcs/class/Mono.Security/Mono.Security.Protocol.Tls.Handshake/HandshakeMessage.cs:105
at (wrapper remoting-invoke-with-check) Mono.Security.Protocol.Tls.Handshake.HandshakeMessage:Process ()
at Mono.Security.Protocol.Tls.ServerRecordProtocol.ProcessHandshakeMessage (Mono.Security.Protocol.Tls.TlsStream handMsg) [0x0002a] in /opt/mono-3.x/mono-3.2.8/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/ServerRecordProtocol.cs:74
at Mono.Security.Protocol.Tls.RecordProtocol.InternalReceiveRecordCallback (IAsyncResult asyncResult) [0x00123] in /opt/mono-3.x/mono-3.2.8/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/RecordProtocol.cs:397
--- End of inner exception stack trace ---
at Mono.Security.Protocol.Tls.SslStreamBase.AsyncHandshakeCallback (IAsyncResult asyncResult) [0x00044] in /opt/mono-3.x/mono-3.2.8/mcs/class/Mono.Security/Mono.Security.Protocol.Tls/SslStreamBase.cs:111

Firefox still works with this exception. But Chrome cannot handle it. How to fix this issue?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the sample from Main using Mono 3.2.8, the wss://localhost:8182 server, and the supplied certificate, then compare Chrome and Firefox handshakes. Start with the Mono TLS stack-trace locations Context.cs:419 and TlsClientHello.cs:109; done means the secure WebSocket connection succeeds in Chrome without the reported protocol error.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.