class SSLyze::XML::HTTPHeaders::HTTPPublicKeyPinning

Represents the `<httpPublicKeyPinning>` XML element.

@since 1.0.0

Public Class Methods

new(node) click to toggle source

Initializes the {HTTPPublicKeyPinning} element.

# File lib/sslyze/xml/http_headers/http_public_key_pinning.rb, line 23
def initialize(node)
  @node = node
end

Public Instance Methods

each_pin_sha256() { |inner_text| ... } click to toggle source

Parses each `pinSha256` XML element.

@yield [sha256]

Yields each SHA256 checksum.

@yieldparam [String] sha256

An individual pinned SHA256 checksum.

@return [Enumerator]

# File lib/sslyze/xml/http_headers/http_public_key_pinning.rb, line 38
def each_pin_sha256
  return enum_for(__method__) unless block_given?

  @node.xpath('pinSha256').each do |element|
    yield element.inner_text
  end
end
Also aliased as: each_sha256
each_sha256()
Alias for: each_pin_sha256
include_sub_domains?() click to toggle source

Parses the `includeSubDomains` XML attribute.

@return [Boolean]

# File lib/sslyze/xml/http_headers/http_public_key_pinning.rb, line 64
def include_sub_domains?
  Boolean[@node['includeSubDomains']]
end
is_backup_pin_configured?() click to toggle source

Parses the `isBackupPinConfigured` XML attribute.

@return [Boolean]

# File lib/sslyze/xml/http_headers/http_public_key_pinning.rb, line 114
def is_backup_pin_configured?
  Boolean[@node['isBackupPinConfigured']]
end
is_valid_pin_configured?() click to toggle source

Parses the `isValidPinConfigured` XML attribute.

@return [Boolean]

# File lib/sslyze/xml/http_headers/http_public_key_pinning.rb, line 105
def is_valid_pin_configured?
  Boolean[@node['isValidPinConfigured']]
end
max_age() click to toggle source

Parses the `maxAge` attribute.

@return [Integer, nil]

# File lib/sslyze/xml/http_headers/http_public_key_pinning.rb, line 73
def max_age
  @max_age ||= if (value = @node['maxAge'])
                 value.to_i
               end
end
pin_sha256s() click to toggle source

@return [Array<String>]

@see each_pin_sha256

# File lib/sslyze/xml/http_headers/http_public_key_pinning.rb, line 53
def pin_sha256s
  each_pin_sha256.to_a
end
Also aliased as: sha256s
report_only() click to toggle source

Parses the `reportOnly` XML attribute.

@return [Boolean]

# File lib/sslyze/xml/http_headers/http_public_key_pinning.rb, line 84
def report_only
  Boolean[@node['reportOnly']]
end
report_uri() click to toggle source

Parses the `reportUri` XML attribute.

@return [String, nil]

# File lib/sslyze/xml/http_headers/http_public_key_pinning.rb, line 93
def report_uri
  @report_uri ||= case (value = @node['reportUri'])
                  when nil, 'None' then nil
                  else                  value
                  end
end
sha256s()
Alias for: pin_sha256s