nacl_io。无法建立SSL连接

时间:2016-05-23 05:52:05

标签: ssl https websocket openssl google-nativeclient

我编写了chrome打包应用程序,作为websocket服务器。它在'ws://127.0.0.1:9876'连接时工作正常,但不在'wss://127.0.0.1:9876'。建立了与websocket客户端的连接,但 SSL握手挂起 SSL_accept()功能(多次尝试)并在超时时断开连接(在我的情况下为5秒)。

[2016/04/23 05:06:37:2455] DEBUG: SSL_accept failed 2 / error:00000002:lib(0):func(0):system lib
[2016/04/23 05:06:37:2458] INFO: SSL_ERROR_WANT_READ
[2016/04/23 05:06:43:0539] NOTICE: wsi 0xfe4be090: TIMEDOUT WAITING on 9 (did hdr 0, ah 0xfe1e0008, wl 0, pfd events 0)

另一方面,websocket客户端告诉webserver关闭连接(chrome.exe)

WebSocket connection to 'wss://127.0.0.1:9876/' failed: Error in connection establishment: net::ERR_CONNECTION_CLOSED

如果我启动openssl测试,结果相同:

$ openssl s_client -showcerts -connect 127.0.0.1:9876
CONNECTED(00000003)
6280256:error:140790E5:SSL routines:SSL23_WRITE:ssl handshake failure:s23_lib.c:177:
---
no peer certificate available
---
No client certificate CA names sent
---
SSL handshake has read 0 bytes and written 318 bytes
---
New, (NONE), Cipher is (NONE)
Secure Renegotiation IS NOT supported
Compression: NONE
Expansion: NONE
---

要构建我已经移植到naclports / webports libwebsockets(ver.2.0 https://libwebsockets.org/)和openssl(1.0.2e)。此外,我已经生成了我的自签名证书和私钥,并硬编码到我的代码中。似乎问题与证书无关,因为我在ubuntu上构建了libwebsockets-test-server,对同一个客户端工作正常。

  1. 有没有人知道如何在nacl代码中创建安全的Websocket或HTTPS SSL连接
  2. 如何将'canonical_hostname = naclhost'更改为我的域名,例如'abcd.com'?
  3. 谢谢!

0 个答案:

没有答案