Skip to content

Error in Secure Websocket #214

@ghost

Description

Hello,

i need your help, i'm using your console app sample to test secure WebSockets (wss)
i did changes to your code as below:

console cs:
var server = new WebSocketServer("wss://127.0.0.1:2080");
server.Certificate = new X509Certificate2(@"[path]\beaweb.cert.pfx", "password");

client.html:
window.ws = new wsImpl('wss://127.0.0.1:2080/');

i have used openssl to generate my certificate:

  1. openssl req -x509 -days 1460 -newkey rsa:2048 -keyout beaweb.key.pem -out beaweb.cert.pem
    pwd: [password]

  2. openssl pkcs12 -export -in beaweb.cert.pem -inkey beaweb.key.pem -out beaweb.cert.pfx
    pwd: [password]

  3. openssl pkcs12 -in beaweb.cert.pfx -clcerts -nokeys -out beaweb.cert.public.pem
    pwd: [password]

when i tried to run your sample after this i got the below exception:

2/6/2018 3:55:40 PM [Info] Server started at wss://127.0.0.1:2080 (actual port 2080)
2/6/2018 3:55:40 PM [Debug] Using default TLS 1.0 security protocol.
2/6/2018 3:55:55 PM [Debug] Client connected from 127.0.0.1:10953
2/6/2018 3:55:55 PM [Debug] Authenticating Secure Connection
2/6/2018 3:55:55 PM [Warn] Failed to Authenticate System.AggregateException: One or more errors occurred. ---> System.IO.IOException: Authentication failed because the remote party has closed the transport stream.
at System.Net.Security.SslState.InternalEndProcessAuthentication(LazyAsyncResult lazyResult)
at System.Net.Security.SslState.EndProcessAuthentication(IAsyncResult result)
at System.Net.Security.SslStream.EndAuthenticateAsServer(IAsyncResult asyncResult)
at System.Threading.Tasks.TaskFactory1.FromAsyncCoreLogic(IAsyncResult iar, Func2 endFunction, Action1 endAction, Task1 promise, Boolean requiresSynchronization)
--- End of inner exception stack trace ---
---> (Inner Exception #0) System.IO.IOException: Authentication failed because the remote party has closed the transport stream.
at System.Net.Security.SslState.InternalEndProcessAuthentication(LazyAsyncResult lazyResult)
at System.Net.Security.SslState.EndProcessAuthentication(IAsyncResult result)
at System.Net.Security.SslStream.EndAuthenticateAsServer(IAsyncResult asyncResult)
at System.Threading.Tasks.TaskFactory1.FromAsyncCoreLogic(IAsyncResult iar, Func2 endFunction, Action1 endAction, Task1 promise, Boolean requiresSynchronization)<---

i need to know if i missed something, i need your help because i built mvc web application communicating to client hardware like camera, fingerprint and passport reader using your library,
it's working fine when i running my site as http, but it faild when i switch to https!

thank you

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions