StreamPeerSSL¶
Inherits: StreamPeer < Reference < Object
SSL流对等体。
描述¶
SSL 流对等体。此对象可用于连接到 SSL 服务器或接受单个 SSL 客户端连接。
教程¶
属性¶
|
方法¶
accept_stream ( StreamPeer stream, CryptoKey private_key, X509Certificate certificate, X509Certificate chain=null ) |
|
connect_to_stream ( StreamPeer stream, bool validate_certs=false, String for_hostname="", X509Certificate valid_certificate=null ) |
|
void |
|
get_status ( ) const |
|
void |
poll ( ) |
枚举¶
enum Status:
STATUS_DISCONNECTED = 0 --- 表示已断开连接的
StreamPeerSSL
的状态。STATUS_HANDSHAKING = 1 --- 代表在握手期间
StreamPeerSSL
的状态。STATUS_CONNECTED = 2 --- 表示连接到主机的
StreamPeerSSL
的状态。STATUS_ERROR = 3 --- 代表
StreamPeerSSL
处于错误状态的状态。STATUS_ERROR_HOSTNAME_MISMATCH = 4 --- 一种错误状态,显示主机提交的SSL证书域与请求验证的域不匹配。
属性说明¶
bool blocking_handshake
Default |
|
Setter |
set_blocking_handshake_enabled(value) |
Getter |
is_blocking_handshake_enabled() |
方法说明¶
Error accept_stream ( StreamPeer stream, CryptoKey private_key, X509Certificate certificate, X509Certificate chain=null )
使用给定的 private_key
接受对等连接作为服务器,并向客户端提供给定的 certificate
。您可以传递可选的 chain
参数以提供额外的 CA 链信息以及证书。
Error connect_to_stream ( StreamPeer stream, bool validate_certs=false, String for_hostname="", X509Certificate valid_certificate=null )
使用底层 StreamPeer stream
连接到对等点。如果 validate_certs
是 true
,StreamPeerSSL
将验证对等方提供的证书是否与 for_hostname
匹配。
注意: 由于浏览器限制,HTML5 导出不支持指定自定义 valid_certificate
。
void disconnect_from_stream ( )
与主机断开连接。
Status get_status ( ) const
返回连接的状态。有关值,请参阅Status。
void poll ( )
轮询连接以检查传入的字节。在 StreamPeer.get_available_bytes 之前调用它以使其正常工作。