Sha256: 8ae9be608c5dd381329cdfcf259b18bb47b3ad6a2d34a2f5f78959494167a7bf

Contents?: true

Size: 1.13 KB

Versions: 1

Compression:

Stored size: 1.13 KB

Contents

require 'sslyze/certificate_chain'
require 'sslyze/certificate_validation'
require 'sslyze/ocsp_response'

module SSLyze
  #
  # Represents the `<certinfo>` element.
  #
  class CertInfo

    #
    # Initializes the cert info.
    #
    # @param [Nokogiri::XML::Node] node
    #   The `<certinfo>` element.
    #
    def initialize(node)
      @node = node
    end

    #
    # Certificate chain.
    #
    # @return [CertificateChain, nil]
    #
    def chain
      @chain ||= if (cert_chain = @node.at('certificateChain'))
                   CertificateChain.new(cert_chain)
                 end
    end

    #
    # Certificate validation information.
    #
    # @return [CertificateValidation]
    #
    def validation
      @validation ||= CertificateValidation.new(@node.at('certificateValidation'))
    end

    #
    # OCSP response stapling information.
    #
    # @return [OCSPResponse, nil]
    #
    def ocsp_response
      @ocsp_response ||= if (ocsp_response = @node.at('ocspStapling/ocspResponse'))
                           OCSPResponse.new(ocsp_response)
                         end
    end

    alias ocsp_stapling ocsp_response

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby-sslyze-0.1.0 lib/sslyze/cert_info.rb