PHP 8.2.31
Preview: gem_openssl.rb Size: 2.24 KB
/proc/thread-self/root/opt/alt/ruby19/lib64/ruby/1.9.1/rubygems/gem_openssl.rb

#--
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
# See LICENSE.txt for permissions.
#++

#--
# Some system might not have OpenSSL installed, therefore the core
# library file openssl might not be available.  We localize testing
# for the presence of OpenSSL in this file.
#++

module Gem
  class << self
    ##
    # Is SSL (used by the signing commands) available on this
    # platform?

    def ssl_available?
      @ssl_available
    end

    ##
    # Is SSL available?

    attr_writer :ssl_available

    ##
    # Ensure that SSL is available.  Throw an exception if it is not.

    def ensure_ssl_available
      unless ssl_available?
        raise Gem::Exception, "SSL is not installed on this system"
      end
    end
  end
end

# :stopdoc:

begin
  require 'openssl'

  # Reference a constant defined in the .rb portion of ssl (just to
  # make sure that part is loaded too).

  Gem.ssl_available = !!OpenSSL::Digest::SHA1

  class OpenSSL::X509::Certificate
    # Check the validity of this certificate.
    def check_validity(issuer_cert = nil, time = Time.now)
      ret = if @not_before && @not_before > time
              [false, :expired, "not valid before '#@not_before'"]
            elsif @not_after && @not_after < time
              [false, :expired, "not valid after '#@not_after'"]
            elsif issuer_cert && !verify(issuer_cert.public_key)
              [false, :issuer, "#{issuer_cert.subject} is not issuer"]
            else
              [true, :ok, 'Valid certificate']
            end

      # return hash
      { :is_valid => ret[0], :error => ret[1], :desc => ret[2] }
    end
  end

rescue LoadError, StandardError
  Gem.ssl_available = false
end

module Gem::SSL

  # We make our own versions of the constants here.  This allows us
  # to reference the constants, even though some systems might not
  # have SSL installed in the Ruby core package.
  #
  # These constants are only used during load time.  At runtime, any
  # method that makes a direct reference to SSL software must be
  # protected with a Gem.ensure_ssl_available call.

  if Gem.ssl_available? then
    PKEY_RSA = OpenSSL::PKey::RSA
    DIGEST_SHA1 = OpenSSL::Digest::SHA1
  else
    PKEY_RSA = :rsa
    DIGEST_SHA1 = :sha1
  end

end

Directory Contents

Dirs: 4 × Files: 49

Name Size Perms Modified Actions
commands DIR
- drwxr-xr-x 2024-03-03 22:48:12
Edit Download
ext DIR
- drwxr-xr-x 2024-03-03 22:48:12
Edit Download
package DIR
- drwxr-xr-x 2024-03-03 22:48:12
Edit Download
ssl_certs DIR
- drwxr-xr-x 2024-03-03 22:48:12
Edit Download
2.21 KB lrw-r--r-- 2012-04-19 22:43:16
Edit Download
12.46 KB lrw-r--r-- 2011-07-27 02:04:03
Edit Download
4.67 KB lrw-r--r-- 2011-07-27 02:04:03
Edit Download
9.69 KB lrw-r--r-- 2012-04-19 23:38:41
Edit Download
1.83 KB lrw-r--r-- 2012-04-19 22:43:16
Edit Download
2.65 KB lrw-r--r-- 2012-04-19 22:43:16
Edit Download
6.43 KB lrw-r--r-- 2011-10-08 10:53:11
Edit Download
9.94 KB lrw-r--r-- 2011-07-27 02:04:03
Edit Download
5.58 KB lrw-r--r-- 2011-10-08 10:53:11
Edit Download
1.81 KB lrw-r--r-- 2011-10-08 10:53:11
Edit Download
5.55 KB lrw-r--r-- 2011-07-27 02:04:03
Edit Download
793 B lrw-r--r-- 2011-07-27 02:04:03
Edit Download
2.34 KB lrw-r--r-- 2011-07-27 02:04:03
Edit Download
379 B lrw-r--r-- 2011-07-27 02:04:03
Edit Download
1.96 KB lrw-r--r-- 2012-04-19 22:43:16
Edit Download
1.86 KB lrw-r--r-- 2011-07-27 02:04:03
Edit Download
2.24 KB lrw-r--r-- 2011-08-05 20:18:14
Edit Download
4.57 KB lrw-r--r-- 2011-10-08 10:53:11
Edit Download
2.38 KB lrw-r--r-- 2011-07-27 02:04:03
Edit Download
16.85 KB lrw-r--r-- 2011-10-08 10:53:11
Edit Download
16.94 KB lrw-r--r-- 2012-10-25 09:18:59
Edit Download
3.10 KB lrw-r--r-- 2012-04-19 22:43:16
Edit Download
3.87 KB lrw-r--r-- 2011-07-27 02:04:03
Edit Download
3.36 KB lrw-r--r-- 2011-07-27 02:04:03
Edit Download
1.05 KB lrw-r--r-- 2011-07-27 02:04:03
Edit Download
3.69 KB lrw-r--r-- 2011-07-27 02:04:03
Edit Download
2.15 KB lrw-r--r-- 2011-07-27 02:04:03
Edit Download
3.79 KB lrw-r--r-- 2011-07-27 02:04:03
Edit Download
1.50 KB lrw-r--r-- 2011-08-26 01:12:57
Edit Download
5.55 KB lrw-r--r-- 2012-04-19 22:43:16
Edit Download
498 B lrw-r--r-- 2012-04-19 22:43:16
Edit Download
1.34 KB lrw-r--r-- 2012-04-19 22:43:16
Edit Download
13.50 KB lrw-r--r-- 2012-04-19 23:38:41
Edit Download
4.99 KB lrw-r--r-- 2012-04-19 22:43:16
Edit Download
577 B lrw-r--r-- 2011-07-27 02:04:03
Edit Download
28.83 KB lrw-r--r-- 2011-07-27 02:04:03
Edit Download
21.93 KB lrw-r--r-- 2011-10-08 10:53:11
Edit Download
11.00 KB lrw-r--r-- 2011-10-08 10:53:11
Edit Download
54.68 KB lrw-r--r-- 2012-04-19 22:43:16
Edit Download
7.17 KB lrw-r--r-- 2012-04-19 22:43:16
Edit Download
3.96 KB lrw-r--r-- 2012-04-19 23:38:41
Edit Download
21.89 KB lrw-r--r-- 2012-04-19 22:43:16
Edit Download
3.47 KB lrw-r--r-- 2011-08-05 20:18:14
Edit Download
1.23 KB lrw-r--r-- 2011-07-27 02:04:03
Edit Download
6.77 KB lrw-r--r-- 2011-07-27 03:42:40
Edit Download
11.22 KB lrw-r--r-- 2011-08-05 20:18:14
Edit Download
4.65 KB lrw-r--r-- 2011-07-27 02:04:03
Edit Download
10.18 KB lrw-r--r-- 2013-12-22 04:38:28
Edit Download
1.59 KB lrw-r--r-- 2011-07-27 02:04:03
Edit Download

If ZipArchive is unavailable, a .tar will be created (no compression).