对于以下代码certificate verify failed (OpenSSL::SSL::SSLError)
:
代码
require 'mechanize'
agent = Mechanize.new
#{|a| a.ssl_version, a.verify_mode = 'SSLv3', OpenSSL::SSL::VERIFY_NONE}
agent.set_proxy('3.209.30.25', 80)
agent.ssl_version='SSLv3'
agent.verify_mode= OpenSSL::SSL::VERIFY_PEER
page = agent.get "https://gegsltraining.aravo.com/"
错误
C:/Ruby193/lib/ruby/gems/1.9.1/gems/net-http-persistent-2.8/lib/net/http/persist
ent/ssl_reuse.rb:70:in `connect': SSL_connect returned=1 errno=0 state=SSLv3 rea
d server certificate B: certificate verify failed (OpenSSL::SSL::SSLError)
编辑
我只是修改了代码如下:
require 'mechanize'
agent = Mechanize.new
#{|a| a.ssl_version, a.verify_mode = 'SSLv3', OpenSSL::SSL::VERIFY_NONE}
agent.set_proxy('3.209.30.25', 80)
agent.ssl_version='SSLv3'
cert_store = OpenSSL::X509::Store.new
cert_store.add_file 'E:\WIPData\Ruby\Scripts\cacert.pem'
agent.cert_store = cert_store
agent.verify_mode= OpenSSL::SSL::VERIFY_PEER (tried OpenSSL::SSL::VERIFY_NONE none of them going good)
新错误
E:\WIPData\Ruby\Scripts>mechanizev1.rb
C:/Ruby193/lib/ruby/1.9.1/net/http.rb:2632:in `error!': 500 "Internal Server Err
or" (Net::HTTPFatalError)
如何成功完成认证验证?帮我。