"证书验证失败"尽管在Windows 10中设置了CACERT.PEM环境变量

时间:2016-05-28 20:10:49

标签: ruby windows ssl openssl

我已正确设置环境变量SSL_CERT_FILE - 此处为set的cmd输出:

  

SSL_CERT_FILE = C:\ RailsInstaller \ cacert.pem

这是我在cacert.pem中的链接:cacert.pem

这是运行irb:

的cmd窗口输出
C:\Users\anon\prog\workspace>irb
irb(main):001:0> require 'open-uri'
=> true
irb(main):002:0> open ('https://www.youtube.com')
OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/net/http.rb:923:in `connect'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/net/http.rb:923:in `block in connect'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/timeout.rb:75:in `timeout'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/net/http.rb:923:in `connect'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/net/http.rb:863:in `do_start'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/net/http.rb:852:in `start'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/open-uri.rb:313:in `open_http'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/open-uri.rb:724:in `buffer_open'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/open-uri.rb:210:in `block in open_loop'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/open-uri.rb:208:in `catch'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/open-uri.rb:208:in `open_loop'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/open-uri.rb:149:in `open_uri'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/open-uri.rb:704:in `open'
        from C:/RailsInstaller/Ruby2.1.0/lib/ruby/2.1.0/open-uri.rb:34:in `open'
        from (irb):2
        from C:/RailsInstaller/Ruby2.1.0/bin/irb:11:in `<main>'
irb(main):003:0>

0 个答案:

没有答案