Class: SSLyze::XML::HTTPHeaders::HTTPPublicKeyPinning
- Inherits:
-
Object
- Object
- SSLyze::XML::HTTPHeaders::HTTPPublicKeyPinning
- Includes:
- Attributes::Exception, Attributes::IsSupported, Types
- Defined in:
- lib/sslyze/xml/http_headers/http_public_key_pinning.rb
Overview
Represents the <httpPublicKeyPinning>
XML element.
Constant Summary
Constants included from Types
Instance Method Summary collapse
-
#each_pin_sha256 {|sha256| ... } ⇒ Enumerator
(also: #each_sha256)
Parses each
pinSha256
XML element. -
#include_sub_domains? ⇒ Boolean
Parses the
includeSubDomains
XML attribute. -
#initialize(node) ⇒ HTTPPublicKeyPinning
constructor
Initializes the HTTPPublicKeyPinning element.
-
#is_backup_pin_configured? ⇒ Boolean
Parses the
isBackupPinConfigured
XML attribute. -
#is_valid_pin_configured? ⇒ Boolean
Parses the
isValidPinConfigured
XML attribute. -
#max_age ⇒ Integer?
Parses the
maxAge
attribute. - #pin_sha256s ⇒ Array<String> (also: #sha256s)
-
#report_only ⇒ Boolean
Parses the
reportOnly
XML attribute. -
#report_uri ⇒ String?
Parses the
reportUri
XML attribute.
Methods included from Attributes::Exception
Methods included from Attributes::IsSupported
Constructor Details
#initialize(node) ⇒ HTTPPublicKeyPinning
Initializes the SSLyze::XML::HTTPHeaders::HTTPPublicKeyPinning element.
23 24 25 |
# File 'lib/sslyze/xml/http_headers/http_public_key_pinning.rb', line 23 def initialize(node) @node = node end |
Instance Method Details
#each_pin_sha256 {|sha256| ... } ⇒ Enumerator Also known as: each_sha256
Parses each pinSha256
XML element.
38 39 40 41 42 43 44 |
# 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 |
#include_sub_domains? ⇒ Boolean
Parses the includeSubDomains
XML attribute.
64 65 66 |
# 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? ⇒ Boolean
Parses the isBackupPinConfigured
XML attribute.
114 115 116 |
# 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? ⇒ Boolean
Parses the isValidPinConfigured
XML attribute.
105 106 107 |
# File 'lib/sslyze/xml/http_headers/http_public_key_pinning.rb', line 105 def is_valid_pin_configured? Boolean[@node['isValidPinConfigured']] end |
#max_age ⇒ Integer?
Parses the maxAge
attribute.
73 74 75 76 77 |
# 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 ⇒ Array<String> Also known as: sha256s
53 54 55 |
# File 'lib/sslyze/xml/http_headers/http_public_key_pinning.rb', line 53 def pin_sha256s each_pin_sha256.to_a end |
#report_only ⇒ Boolean
Parses the reportOnly
XML attribute.
84 85 86 |
# File 'lib/sslyze/xml/http_headers/http_public_key_pinning.rb', line 84 def report_only Boolean[@node['reportOnly']] end |
#report_uri ⇒ String?
Parses the reportUri
XML attribute.
93 94 95 96 97 98 |
# 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 |