Class: SSLyze::OCSPResponse

Inherits:
Object
  • Object
show all
Includes:
Types
Defined in:
lib/sslyze/ocsp_response.rb

Overview

Represents the <ocspResponse> XML element.

Constant Summary

Constants included from Types

Types::Boolean, Types::None

Instance Method Summary collapse

Constructor Details

#initialize(node) ⇒ OCSPResponse

Initializes the OCSP response.

Parameters:

  • node (Nokogiri::XML::Node)

    The <ocspResponse> XML element.



19
20
21
# File 'lib/sslyze/ocsp_response.rb', line 19

def initialize(node)
  @node = node
end

Instance Method Details

#produced_atTime

When the response was produced.

Returns:

  • (Time)


82
83
84
# File 'lib/sslyze/ocsp_response.rb', line 82

def produced_at
  @produced_at ||= Time.parse(@node.at('producedAt').inner_text)
end

#responder_idString

The responder ID.

Returns:

  • (String)


46
47
48
# File 'lib/sslyze/ocsp_response.rb', line 46

def responder_id
  @id ||= @node.at('responderID').inner_text
end

#statusSymbol

The response status.

Returns:

  • (Symbol)


64
65
66
# File 'lib/sslyze/ocsp_response.rb', line 64

def status
  @status ||= @node.at('responseStatus').inner_text.to_sym
end

#successful?Boolean

Determines whether the OCSP response was a success.

Returns:



73
74
75
# File 'lib/sslyze/ocsp_response.rb', line 73

def successful?
  status == :successful
end

#trusted?Boolean

Specifies whether the response was trusted.

Returns:



28
29
30
# File 'lib/sslyze/ocsp_response.rb', line 28

def trusted?
  Boolean[@node['isTrustedByMozillaCAStore']]
end

#typeString

The response type.

Returns:

  • (String)


37
38
39
# File 'lib/sslyze/ocsp_response.rb', line 37

def type
  @type ||= @node.at('responseType').inner_text
end

#versionInteger

The OCSP version.

Returns:

  • (Integer)


55
56
57
# File 'lib/sslyze/ocsp_response.rb', line 55

def version
  @version ||= @node.at('version').inner_text.to_i
end