Skip to content

Instantly share code, notes, and snippets.

@evg2108
Created May 20, 2016 10:47
Show Gist options
  • Save evg2108/08636f309d3e3549c79d0877f57f20ed to your computer and use it in GitHub Desktop.
Save evg2108/08636f309d3e3549c79d0877f57f20ed to your computer and use it in GitHub Desktop.
  @agent = Mechanize.new
  @agent.user_agent_alias = 'Linux Mozilla'
  @agent.redirect_ok = true
  @agent.read_timeout = 60
  @agent.ssl_version = 'SSLv3'
  cert = OpenSSL::PKCS12.new(File.open('my_pfx.pfx'), 'password')
  @agent.cert = cert.certificate
  @agent.key = cert.key
  f = File.open('ca.crt', 'w')
  f.write(cert.ca_certs.map(&:to_s).join)
  f.close
  @agent.ca_file = f.path
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment