Skip to content

Instantly share code, notes, and snippets.

Created August 29, 2016 14:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save anonymous/f5bf2b0d9b9d341bb43f6380e9bf293b to your computer and use it in GitHub Desktop.
Save anonymous/f5bf2b0d9b9d341bb43f6380e9bf293b to your computer and use it in GitHub Desktop.
## Approach 1
ssl_ctx = OpenSSL::SSL::SSLContext.new()
ssl_ctx.verify_mode = OpenSSL::SSL::VERIFY_PEER | OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT
ssl_ctx.ca_file = File.join(File.dirname(__FILE__), "cacert.pem")
## Approach 2
cert_store = OpenSSL::X509::Store.new
cert_store.add_file(File.join(File.dirname(__FILE__), "cacert.pem"))
ssl_ctx = OpenSSL::SSL::SSLContext.new()
ssl_ctx.cert_store = cert_store
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment