阿西河

所有教程

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

我的收藏

    最近访问  (文章)

      教程列表

      抓包专区
      测试专区

      Node.js tls Server OCSPRequest 事件

      Node.js tls Server OCSPRequest 事件

      新增于: v0.11.13

      The ‘OCSPRequest’ event is emitted when the client sends a certificate status request. The listener callback is passed three arguments when called:

      • certificate < Buffer> The server certificate
      • issuer < Buffer> The issuer’s certificate
      • callback < Function> A callback function that must be invoked to provide the results of the OCSP request.

      The server’s current certificate can be parsed to obtain the OCSP URL and certificate ID; after obtaining an OCSP response, callback(null, resp) is then invoked, where resp is a Buffer instance containing the OCSP response. Both certificate and issuer are Buffer DER-representations of the primary and issuer’s certificates. These can be used to obtain the OCSP certificate ID and OCSP endpoint URL.

      Alternatively, callback(null, null) may be called, indicating that there was no OCSP response.

      Calling callback(err) will result in a socket.destroy(err) call.

      The typical flow of an OCSP Request is as follows:

      1. Client connects to the server and sends an ‘OCSPRequest’ (via the status info extension in ClientHello).
      2. Server receives the request and emits the ‘OCSPRequest’ event, calling the listener if registered.
      3. Server extracts the OCSP URL from either the certificate or issuer and performs an OCSP request to the CA.
      4. Server receives ‘OCSPResponse’ from the CA and sends it back to the client via the callback argument
      5. Client validates the response and either destroys the socket or performs a handshake.

      The issuer can be null if the certificate is either self-signed or the issuer is not in the root certificates list. (An issuer may be provided via the ca option when establishing the TLS connection.)

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

      An npm module like asn1.js may be used to parse the certificates.


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


      目录
      本文目录
      目录