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-0.9.0 lib/skylight/util/ssl.rb
skylight-0.8.1 lib/skylight/util/ssl.rb
skylight-0.8.0 lib/skylight/util/ssl.rb
skylight-0.8.0.beta.3 lib/skylight/util/ssl.rb
skylight-0.8.0.beta.1 lib/skylight/util/ssl.rb
skylight-0.7.1 lib/skylight/util/ssl.rb
skylight-0.7.0.beta.3 lib/skylight/util/ssl.rb
truex-skylight-0.6.0 lib/skylight/util/ssl.rb
skylight-0.7.0.beta.2 lib/skylight/util/ssl.rb
skylight-0.7.0.beta.1 lib/skylight/util/ssl.rb
skylight-0.6.2.beta.2 lib/skylight/util/ssl.rb
skylight-0.6.1 lib/skylight/util/ssl.rb
skylight-0.6.0 lib/skylight/util/ssl.rb
skylight-0.6.0.beta.1 lib/skylight/util/ssl.rb
skylight-0.5.2 lib/skylight/util/ssl.rb
skylight-0.5.1 lib/skylight/util/ssl.rb
skylight-0.5.0 lib/skylight/util/ssl.rb
skylight-0.4.3 lib/skylight/util/ssl.rb
skylight-0.5.0.beta1 lib/skylight/util/ssl.rb
skylight-0.4.2 lib/skylight/util/ssl.rb