nodejs tls session id

这一生的挚爱 提交于 2019-12-11 03:31:47

问题


I am using TLS to create session using node.js library. Node.js does it provide a way to retrieve session id of TLS connection established. It is part of SSL ctx in openssl.

Can it be done without using connect, express or geddy?


回答1:


Unfortunately I don't think that information is exposed from the SSL context for node connections.

You can access the node object representing the context as follows:

var con = tls.connect(..., ...);

con.pair.credentials.context

Unfortunately, the only methods available on that object are setKey, setCert, addCACert, addCRL, addRootCerts, setCiphers and setOptions.

That said, with a little bit of C++ and SSL know-how and come copy/pasting, you could probably patch node's node_crypto.cc and node_crypto.h files to add that lookup without TOO much work.




回答2:


You can't get the session_id but you can get the session itself for caching / resume purposes by calling conn.getSession() once the connection is established.



来源:https://stackoverflow.com/questions/7331407/nodejs-tls-session-id

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!