-
Notifications
You must be signed in to change notification settings - Fork 591
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Error in Secure Websocket #214
Comments
If you are testing in Chrome, you may need to use TLS 1.2. Seems recently Chrome has tightened up security protocols that can be used. I had to change this to get it to work. To use TLS 1.2 on the socket server, set: On the socket server, try listening on 0.0.0.0 On the client, if using wss, you need to use the url of the domain the ssl certificate is registered for, not an ip address: |
i did everything as you said, only worked on IE, not working on (Edge, Chrome, Firefox) what i did: code:
result: from client.html ->
still trying to figure out this, hope you help me to solve this also. thank you |
There must be something wrong with your certificate. My test below works fine. Server, I run this...
client...
I added test.domain.com to host file with local pc ip address obviously because the domain is not registered. I exported the certificate file from the certificate store, including all "extended properties". Just keep experimenting with the certificate file, |
I spent my whole day to figure out what is the problem, I know the problem is about my generated certificate. would you please help me? What tool you used to create the certificate? and the generated certificate should be in trusted root? Appreciate your help. Thank you so much |
Everyone seems to have a different way of generating these certificates & 99% never seem to work. So here goes with how I get it to work... This will create an ssl certificate using Install Save below as
open cmd run: run: run: Import "test.crt" into certificate store:
Export this certificate from the store:
run: run: Import "final_result.pfx" into the certificate store:
Repeat above import steps 1 to 7 again, but this time in step 6, place the certificate in the "Web Hosting" certificate store (so that IIS can see the certificate when binding to https) Export this certificate from the store (to use in the socket server app):
Add Create IIS website & add bindings to test.com for both http & https (and select the test.com certificate in the https bindings) Visit https://test.com/your-socket-client.htm (in Chrome/Edge, click advanced > proceed when prompted for ssl warning) Socket client should now connect successfully over wss using |
Thank you so much, I’ll walkthrough your steps Sunday morning since we in weekend here. I’ll let you know Appreciate your help |
Thank you so much, it's working in all browsers on local machine. but i have 1 question, what i should do when i publish my site on production? of course i can't use test certificate due to company privacy, i have to use the issued certificate by security team. is there any recommendations or steps to make my site running as my local machine? appreciate your help. thank you so much again |
Good to hear! For production, this is easier. There are no openssl processes to do at all. Add the real certificate to the Certificate Store, then find it in the Certificate Store, right click it, select all Tasks > Export, then follow the same steps as in the last export process described above. It must be saved as a You don't need to add any host file entries. |
so it's security team task. hope it work on production thank you so much |
you are the best!!! |
我按照你上的弄 为啥不可以呢 都弄了呀 |
每一步有异常信息吗?我测试没问题 |
I'm new to all of this and I'm struggling to get this procedure to work with a secure websocket server. The server will be running on the client's machine (i.e. wss://localhost:996/), and I'm not sure how this plays with the use of test.com in the certificate. Do I need to change the DNS.x entries in the cnf to somehow match the use of localhost? Or is test.com just a placeholder? By the way, the error I'm seeing when I try to connect is on the server side. I'm getting a AuthenticationException with a message of "A call to SSPI failed" and an inner exception with the message "function requested is not supported". This means little to me. Which function is not supported? Any insight you could provide would be most helpful. |
Run your site through IIS with a "test" domain as per instructions above. The certificate name has to match the domain you're using to run the site. Can be any domain name of your choice, just that test.com is fitting. Follow the steps in comment #214 (comment) Do not skip/miss anything and you should be good. Get Visual Studio to run through the "test.com" IIS site instead of IIS Express so you still have the usual debugging experience. |
hello sir,w want run wss server in linux, my app is net6 framework, i create by openssl by "openssl req -new -x509 -days 365 -nodes -out self.pem -keyout self.pem", but when i run app,err:"Listener socket is closed System.AggregateException: One or more errors occurred. (The server mode SSL must use a certificate with the associated private key.) |
@cuican6 follow the instructions above (#214 (comment)) exactly. The end result certificate file has to be |
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:
openssl req -x509 -days 1460 -newkey rsa:2048 -keyout beaweb.key.pem -out beaweb.cert.pem
pwd: [password]
openssl pkcs12 -export -in beaweb.cert.pem -inkey beaweb.key.pem -out beaweb.cert.pfx
pwd: [password]
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.TaskFactory
1.FromAsyncCoreLogic(IAsyncResult iar, Func
2 endFunction, Action1 endAction, Task
1 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.TaskFactory
1.FromAsyncCoreLogic(IAsyncResult iar, Func
2 endFunction, Action1 endAction, Task
1 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
The text was updated successfully, but these errors were encountered: