当被要求使用TLSv1_2时,Ruby的net / http坚持使用SSLv3

时间:2016-06-30 11:36:09

标签: ruby ssl openssl

这个ruby代码应该连接到安全通道:

connection = Net::HTTP.new "localhost", 8081
connection.use_ssl = true
connection.ssl_version = :TLSv1_2
# ...
connection.post path, data, h

我遇到以下错误:

usr/local/rvm/rubies/ruby-2.2.0/lib/ruby/2.2.0/net/http.rb:923:in `connect': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)

客户端确实支持TLSv1.2,它看起来是:

ruby -ropenssl -e 'puts OpenSSL::SSL::SSLContext::METHODS' | grep 1_2
TLSv1_2
TLSv1_2_server
TLSv1_2_client

此外,服务器还支持TLSv1.2

openssl s_client -connect localhost:8081 | grep Protocol
Protocol  : TLSv1.2

为什么Net :: HTTP尝试使用状态state=SSLv3进行连接?

0 个答案:

没有答案