Method: HTTPClient::SSLConfig#add_trust_ca

Defined in:
lib/httpclient/ssl_config.rb

#add_trust_ca(trust_ca_file_or_hashed_dir) ⇒ Object Also known as: set_trust_ca

Sets trust anchor certificate(s) for verification.

trust_ca_file_or_hashed_dir

a filename of a PEM/DER formatted OpenSSL::X509::Certificate or a ‘c-rehash’eddirectory name which stores trusted certificate files.

Calling this method resets all existing sessions.



237
238
239
240
241
242
243
244
# File 'lib/httpclient/ssl_config.rb', line 237

def add_trust_ca(trust_ca_file_or_hashed_dir)
  unless File.exist?(trust_ca_file_or_hashed_dir)
    trust_ca_file_or_hashed_dir = File.join(File.dirname(__FILE__), trust_ca_file_or_hashed_dir)
  end
  @cacerts_loaded = true # avoid lazy override
  add_trust_ca_to_store(@cert_store, trust_ca_file_or_hashed_dir)
  change_notify
end