本文簡要介紹ruby語言中 OpenSSL::SSL::SSLContext.ecdh_curves =
的用法。
用法
ecdh_curves = curve_list → curve_list
為此上下文設置“supported elliptic curves” 列表。
對於 TLS 客戶端,該列表直接用於 Supported Elliptic Curves Extension。對於服務器, OpenSSL
使用該列表來確定共享曲線的集合。 OpenSSL
會從中選擇最合適的一個。
示例
ctx1 = OpenSSL::SSL::SSLContext.new
ctx1.ecdh_curves = "X25519:P-256:P-224"
svr = OpenSSL::SSL::SSLServer.new(tcp_svr, ctx1)
Thread.new { svr.accept }
ctx2 = OpenSSL::SSL::SSLContext.new
ctx2.ecdh_curves = "P-256"
cli = OpenSSL::SSL::SSLSocket.new(tcp_sock, ctx2)
cli.connect
p cli.tmp_key.group.curve_name
# => "prime256v1" (is an alias for NIST P-256)
相關用法
- Ruby SSLContext.add_certificate用法及代碼示例
- Ruby SSLContext.renegotiation_cb用法及代碼示例
- Ruby SSLContext.alpn_select_cb用法及代碼示例
- Ruby SSLContext.min_version =用法及代碼示例
- Ruby SSLContext.alpn_protocols用法及代碼示例
- Ruby SSLContext.tmp_dh =用法及代碼示例
- Ruby SSLContext.npn_protocols用法及代碼示例
- Ruby SSLContext.npn_select_cb用法及代碼示例
- Ruby SSLConfig.new用法及代碼示例
- Ruby SSLSocket.open用法及代碼示例
- Ruby SSLSocket.accept_nonblock用法及代碼示例
- Ruby SSLSocket.connect_nonblock用法及代碼示例
- Ruby Symbol capitalize用法及代碼示例
- Ruby SizedQueue clear()用法及代碼示例
- Ruby Spotter.spot_op_asgn2_for_name用法及代碼示例
- Ruby StringScanner skip_until用法及代碼示例
- Ruby StringScanner search_full用法及代碼示例
- Ruby String.match?用法及代碼示例
- Ruby StringScanner.beginning_of_line?用法及代碼示例
- Ruby Stat.stat <=>用法及代碼示例
- Ruby Symbol.to_proc用法及代碼示例
- Ruby Symbol.end_with?用法及代碼示例
- Ruby StringScanner restsize用法及代碼示例
- Ruby Spotter.spot_opcall_for_name用法及代碼示例
- Ruby Set flatten()用法及代碼示例
注:本文由純淨天空篩選整理自ruby-lang.org大神的英文原創作品 SSLContext.ecdh_curves =。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。