tlsSocket.renegotiate(options, callback)
-
options
<Object>-
rejectUnauthorized
<boolean> 如果不是false
,则服务器证书将根据提供的 CA 列表进行验证。如果验证失败,则触发'error'
事件;err.code
包含 OpenSSL 错误代码。默认值:true
。¥
rejectUnauthorized
<boolean> If notfalse
, the server certificate is verified against the list of supplied CAs. An'error'
event is emitted if verification fails;err.code
contains the OpenSSL error code. Default:true
. -
requestCert
-
-
callback
<Function> 如果renegotiate()
返回true
,则回调将绑定到'secure'
事件。如果renegotiate()
返回false
, 则callback
将在下一个滴答中被调用并出错, 除非tlsSocket
已被销毁, 在这种情况下根本不会调用callback
。¥
callback
<Function> Ifrenegotiate()
returnedtrue
, callback is attached once to the'secure'
event. Ifrenegotiate()
returnedfalse
,callback
will be called in the next tick with an error, unless thetlsSocket
has been destroyed, in which casecallback
will not be called at all. -
返回:<boolean> 如果启动重新协商则为
true
,否则为false
。¥Returns: <boolean>
true
if renegotiation was initiated,false
otherwise.
tlsSocket.renegotiate()
方法启动 TLS 重新协商过程。当完成后,callback
函数将传入一个参数,该参数是 Error
(如果请求失败)或 null
。
¥The tlsSocket.renegotiate()
method initiates a TLS renegotiation process.
Upon completion, the callback
function will be passed a single argument
that is either an Error
(if the request failed) or null
.
此方法可用于在建立安全连接后请求对等方的证书。
¥This method can be used to request a peer's certificate after the secure connection has been established.
当作为服务器运行时,套接字将在 handshakeTimeout
超时后销毁并出现错误。
¥When running as the server, the socket will be destroyed with an error after
handshakeTimeout
timeout.
对于 TLSv1.3,无法发起重协商,协议不支持。
¥For TLSv1.3, renegotiation cannot be initiated, it is not supported by the protocol.