I used to receive the following error:
OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed
from C:/Ruby1.9.2/lib/ruby/1.9.1/net/http.rb:678:in `connect'
after reading through this, I discovered that the fix is to download the cacert.pem file from here. The post recommends doing something like this:
ENV['SSL_CERT_FILE'] = File.join(File.dirname(__FILE__),"cacert.pem")
And, indeed, this solves the problem. However, who reads the value of SSL_CERT_FILE
? Altering the environment doesn't seem like "the Ruby way" of doing it. I'm looking for a solution that could work with both Rails and Sinatra.
The openssl library uses the SSL_CERT_FILE environment variable.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With