阿西河

所有教程

公众号
🌙
阿西河前端的公众号

我的收藏

    最近访问  (文章)

      教程列表

      抓包专区
      测试专区

      Node.js tls Server resumeSession 事件

      Node.js tls Server resumeSession 事件

      新增于: v0.9.2 The ‘resumeSession’ event is emitted when the client requests to resume a previous TLS session. The listener callback is passed two arguments when called:

      • sessionId - The TLS/SSL session identifier
      • callback < Function> A callback function to be called when the prior session has been recovered.

      When called, the event listener may perform a lookup in external storage using the given sessionId and invoke callback(null, sessionData) once finished. If the session cannot be resumed (i.e., doesn’t exist in storage) the callback may be invoked as callback(null, null). Calling callback(err) will terminate the incoming connection and destroy the socket.

      Listening for this event will have an effect only on connections established after the addition of the event listener.

      The following illustrates resuming a TLS session:

      const tlsSessionStore = {};
      server.on('newSession', (id, data, cb) => {
        tlsSessionStore[id.toString('hex')] = data;
        cb();
      });
      server.on('resumeSession', (id, cb) => {
        cb(null, tlsSessionStore[id.toString('hex')] || null);
      });
      

      更多内容请参考:Node.js tls 安全传输层,或者通过 点击对应菜单 进行查看;


      目录
      本文目录
      目录