Module: SSLyze::XML::Certinfo::HasCertificates
- Includes:
- Enumerable
- Defined in:
- lib/sslyze/xml/certinfo/has_certificates.rb
Overview
Instance Method Summary collapse
-
#certificates ⇒ Array<Certificate>
(also: #certs)
Returns all certificates in the chain.
-
#each_certificate {|cert| ... } ⇒ Enumerator
(also: #each_cert, #each)
Enumerates over each certificate in the chain.
-
#each_intermediate {|cert| ... } ⇒ Enumerator
Enumerates over any intermediate certificates in the chain.
-
#intermediates ⇒ Array<Certificate>
Returns all intermediate certificates in the chain.
-
#leaf ⇒ Certificate?
The leaf certificate.
-
#root ⇒ Certificate?
The root certificate.
Instance Method Details
#certificates ⇒ Array<Certificate> Also known as: certs
Returns all certificates in the chain.
42 43 44 |
# File 'lib/sslyze/xml/certinfo/has_certificates.rb', line 42 def certificates each_certificate.to_a end |
#each_certificate {|cert| ... } ⇒ Enumerator Also known as: each_cert, each
Enumerates over each certificate in the chain.
26 27 28 29 30 31 32 |
# File 'lib/sslyze/xml/certinfo/has_certificates.rb', line 26 def each_certificate return enum_for(__method__) unless block_given? @node.xpath('certificate').each do |element| yield Certificate.new(element) end end |
#each_intermediate {|cert| ... } ⇒ Enumerator
Enumerates over any intermediate certificates in the chain.
71 72 73 74 75 76 77 |
# File 'lib/sslyze/xml/certinfo/has_certificates.rb', line 71 def each_intermediate return enum_for(__method__) unless block_given? @node.xpath('certificate[position() > 1 and position() < last()]').each do |element| yield Certificate.new(element) end end |
#intermediates ⇒ Array<Certificate>
Returns all intermediate certificates in the chain.
84 85 86 |
# File 'lib/sslyze/xml/certinfo/has_certificates.rb', line 84 def intermediates each_intermediate.to_a end |
#leaf ⇒ Certificate?
The leaf certificate.
53 54 55 56 57 |
# File 'lib/sslyze/xml/certinfo/has_certificates.rb', line 53 def leaf if (element = @node.at_xpath('certificate[1]')) Certificate.new(element) end end |
#root ⇒ Certificate?
The root certificate.
93 94 95 96 97 |
# File 'lib/sslyze/xml/certinfo/has_certificates.rb', line 93 def root if (element = @node.at_xpath('certificate[last()]')) Certificate.new(element) end end |