Flowdock
method

verify_certificate_identity

Importance_0
Ruby latest stable (v1_9_3_392) - 0 notes - Class: SSL
verify_certificate_identity(cert, hostname) private

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# File ext/openssl/lib/openssl/ssl-internal.rb, line 87
    def verify_certificate_identity(cert, hostname)
      should_verify_common_name = true
      cert.extensions.each{|ext|
        next if ext.oid != "subjectAltName"
        ext.value.split(/,\s+/).each{|general_name|
          if /\ADNS:(.*)/ =~ general_name
            should_verify_common_name = false
            reg = Regexp.escape($1).gsub(/\\\*/, "[^.]+")
            return true if /\A#{reg}\z/ =~ hostname
          elsif /\AIP Address:(.*)/ =~ general_name
            should_verify_common_name = false
            return true if $1 == hostname
          end
        }
      }
      if should_verify_common_name
        cert.subject.to_a.each{|oid, value|
          if oid == "CN"
            reg = Regexp.escape(value).gsub(/\\\*/, "[^.]+")
            return true if /\A#{reg}\z/ =~ hostname
          end
        }
      end
      return false
    end
Register or log in to add new notes.