class Hurley::SslOptions

Public Instance Methods

openssl_cert_store() click to toggle source
# File lib/hurley/options.rb, line 118
def openssl_cert_store
  self[:openssl_cert_store] ||= OpenSSL::X509::Store.new.tap do |store|
    store.set_default_paths
  end
end
openssl_client_cert() click to toggle source
# File lib/hurley/options.rb, line 110
def openssl_client_cert
  self[:openssl_client_cert] ||= begin
    cert_contents = self[:client_cert] || (self[:client_cert_path] && IO.read(self[:client_cert_path]))
    return unless cert_contents
    OpenSSL::X509::Certificate.new(cert_contents)
  end
end
openssl_private_key() click to toggle source
# File lib/hurley/options.rb, line 124
def openssl_private_key
  @openssl_private_key ||= begin
    pkey = if pkey_path = self[:private_key_path]
      File.read(pkey_path)
    else
      self[:private_key]
    end

    return unless pkey

    if OpenSSL::PKey.respond_to?(:read)
      OpenSSL::PKey.read(pkey, self[:private_key_pass])
    else
      OpenSSL::PKey::RSA.new(pkey, self[:private_key_pass])
    end
  end
end
openssl_verify_mode() click to toggle source
# File lib/hurley/options.rb, line 106
def openssl_verify_mode
  skip_verification ? OpenSSL::SSL::VERIFY_NONE : OpenSSL::SSL::VERIFY_PEER
end
skip_verification?() click to toggle source
# File lib/hurley/options.rb, line 102
def skip_verification?
  self[:skip_verification]
end