Sha256: d55e25ce2ffc137133a55412a32b769b1d31f022febcb2886a626ee89d596779

Contents?: true

Size: 1019 Bytes

Versions: 45

Compression:

Stored size: 1019 Bytes

Contents

require 'openssl'

module Skylight
  module Util
    class SSL
      DEFAULT_CA_FILE  = File.expand_path('../../data/cacert.pem', __FILE__)

      def self.detect_ca_cert_file!
        @ca_cert_file = false
        if defined?(OpenSSL::X509::DEFAULT_CERT_FILE)
          f = OpenSSL::X509::DEFAULT_CERT_FILE

          if f && File.exist?(f)
            @ca_cert_file = f
          end
        end
      end

      def self.detect_ca_cert_dir!
        @ca_cert_dir = false
        if defined?(OpenSSL::X509::DEFAULT_CERT_DIR)
          d = OpenSSL::X509::DEFAULT_CERT_DIR

          if d && File.exist?(d)
            @ca_cert_dir = d
          end
        end
      end

      detect_ca_cert_file!
      detect_ca_cert_dir!

      def self.ca_cert_file?
        !!@ca_cert_file
      end

      def self.ca_cert_dir?
        !!@ca_cert_dir
      end

      def self.ca_cert_file_or_default
        @ca_cert_file || DEFAULT_CA_FILE
      end

      def self.ca_cert_dir
        @ca_cert_dir
      end
    end
  end
end

Version data entries

45 entries across 45 versions & 2 rubygems

Version Path
skylight-1.2.2 lib/skylight/util/ssl.rb
skylight-1.2.1 lib/skylight/util/ssl.rb
skylight-1.2.0 lib/skylight/util/ssl.rb
skylight-1.1.0 lib/skylight/util/ssl.rb
skylight-1.0.1 lib/skylight/util/ssl.rb
skylight-1.0.0 lib/skylight/util/ssl.rb
skylight-0.10.6 lib/skylight/util/ssl.rb
skylight-1.0.0.beta5 lib/skylight/util/ssl.rb
skylight-0.10.5 lib/skylight/util/ssl.rb
skylight-0.10.4 lib/skylight/util/ssl.rb
skylight-1.0.0.beta4 lib/skylight/util/ssl.rb
skylight-1.0.0.beta3 lib/skylight/util/ssl.rb
skylight-0.10.3 lib/skylight/util/ssl.rb
skylight-0.10.2 lib/skylight/util/ssl.rb
skylight-1.0.0.beta2 lib/skylight/util/ssl.rb
skylight-0.10.0 lib/skylight/util/ssl.rb
skylight-0.9.4 lib/skylight/util/ssl.rb
skylight-0.9.3 lib/skylight/util/ssl.rb
skylight-0.9.2 lib/skylight/util/ssl.rb
skylight-0.9.1 lib/skylight/util/ssl.rb