Sha256: 602868f169a4a72b8496a37adf130abb6eb69343211a2bcaa2de19cc3e5ff10a

Contents?: true

Size: 960 Bytes

Versions: 2

Compression:

Stored size: 960 Bytes

Contents

require 'sslyze/types'

module SSLyze
  #
  # Represents the `<certificateValidation>` XML element.
  #
  class CertificateValidation

    include Types

    #
    # Initializes the certificate validation.
    #
    # @param [Nokogiri::XML::Node] node
    #   The `<certificateValidation>` XMl element.
    #
    def initialize(node)
      @node = node
    end

    #
    # Specifies whether the hostname was validated.
    #
    # @return [Boolean]
    #
    def hostname?
      Boolean[@node.at('hostnameValidation/@certificateMatchesServerHostname').value]
    end

    #
    # Specifies whether the certificate path was validated against various
    # certificate stores.
    #
    # @return [Hash{String => Boolean}]
    #   The certificate store name and validation result.
    #
    def path
      @path ||= Hash[@node.search('pathValidation').map { |path|
        [path['usingTrustStore'], path['validationResult'] == 'ok']
      }]
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ruby-sslyze-0.1.1 lib/sslyze/certificate_validation.rb
ruby-sslyze-0.1.0 lib/sslyze/certificate_validation.rb