Class: OpenSSL::SSL::SSLContext

Inherits:
Object
  • Object
show all
Defined in:
lib/shared/openssl/dummyssl.rb,
lib/1.8/openssl/ssl-internal.rb,
lib/1.9/openssl/ssl-internal.rb

Constant Summary collapse

DEFAULT_PARAMS =
{
  :ssl_version => "SSLv23",
  :verify_mode => OpenSSL::SSL::VERIFY_PEER,
  :ciphers => "ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM:+LOW",
  :options => OpenSSL::SSL::OP_ALL,
}
DEFAULT_CERT_STORE =
OpenSSL::X509::Store.new

Instance Method Summary collapse

Instance Method Details

#set_params(params = {}) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/1.8/openssl/ssl-internal.rb', line 36

def set_params(params={})
  params = DEFAULT_PARAMS.merge(params)
  # ssl_version need to be set at first.
  self.ssl_version = params.delete(:ssl_version)
  params.each{|name, value| self.__send__("#{name}=", value) }
  if self.verify_mode != OpenSSL::SSL::VERIFY_NONE
    unless self.ca_file or self.ca_path or self.cert_store
      self.cert_store = DEFAULT_CERT_STORE
    end
  end
  return params
end