class SSLyze::XML::Certinfo::Certificate
Represents the `<certificate>` XML
element.
Public Class Methods
Initializes the certificate.
@param [Nokogiri::XML::Node] node
The `<certificate>` XML element.
# File lib/sslyze/xml/certinfo/certificate.rb, line 22 def initialize(node) @node = node end
Public Instance Methods
Compares the other certificiate to this certificate.
@param [Certificate] other
The other certificate.
@return [Boolean]
Whether the other certificate has the same {#as_pem}.
@since 1.0.0
# File lib/sslyze/xml/certinfo/certificate.rb, line 195 def ==(other) other.kind_of?(self.class) && other.as_pem == as_pem end
The AS PEM information.
@return [String]
# File lib/sslyze/xml/certinfo/certificate.rb, line 31 def as_pem @as_pem ||= @node.at_xpath('asPEM').inner_text end
@return [X509::ExtensionSet]
@group OpenSSL Methods
# File lib/sslyze/xml/certinfo/certificate.rb, line 55 def extensions X509::ExtensionSet.new(x509.extensions) end
The HPKP SHA256 Pin.
@return [String]
@since 1.0.0
# File lib/sslyze/xml/certinfo/certificate.rb, line 169 def hpkp_sha256_pin @hpkp_sha256_pin ||= @node['hpkpSha256Pin'] end
@return [X509::Name]
@see www.rubydoc.info/stdlib/openssl/OpenSSL/X509/Name
@group OpenSSL Methods
# File lib/sslyze/xml/certinfo/certificate.rb, line 66 def issuer @issuer ||= X509::Name.new(x509.issuer) end
@return [Time]
@group OpenSSL Methods
# File lib/sslyze/xml/certinfo/certificate.rb, line 75 def not_after x509.not_after end
@return [Time]
@group OpenSSL Methods
# File lib/sslyze/xml/certinfo/certificate.rb, line 84 def not_before x509.not_before end
@return [PublicKey]
@group OpenSSL Methods
# File lib/sslyze/xml/certinfo/certificate.rb, line 93 def public_key @public_key ||= PublicKey.new(@node.at_xpath('publicKey')) end
@return [OpenSSL::BN]
@see www.rubydoc.info/stdlib/openssl/OpenSSL/BN
@group OpenSSL Methods
# File lib/sslyze/xml/certinfo/certificate.rb, line 104 def serial x509.serial end
The SHA1 fingerprint of the cert.
@return [String]
# File lib/sslyze/xml/certinfo/certificate.rb, line 158 def sha1_fingerprint @sha1_fingerprint ||= @node['sha1Fingerprint'] end
@return [String]
@group OpenSSL Methods
# File lib/sslyze/xml/certinfo/certificate.rb, line 113 def signature_algorithm x509.signature_algorithm end
@return [X509::Name]
@group OpenSSL Methods
# File lib/sslyze/xml/certinfo/certificate.rb, line 122 def subject @subject ||= X509::Name.new(x509.subject) end
The supplied server name indication.
@return [String]
@since 1.0.0
# File lib/sslyze/xml/certinfo/certificate.rb, line 180 def supplied_server_name_indication @supplied_server_name_indication ||= @node['suppliedServerNameIndication'] end
@return [String]
@group OpenSSL Methods
# File lib/sslyze/xml/certinfo/certificate.rb, line 131 def to_der x509.to_der end
@return [String]
@group OpenSSL Methods
# File lib/sslyze/xml/certinfo/certificate.rb, line 140 def to_text x509.to_text end
@return [Integer]
@group OpenSSL Methods
# File lib/sslyze/xml/certinfo/certificate.rb, line 149 def version x509.version end
The parsed X509
certificate.
@return [OpenSSL::X509::Certificate]
@see www.rubydoc.info/stdlib/openssl/OpenSSL/X509/Certificate
@since 1.0.0
# File lib/sslyze/xml/certinfo/certificate.rb, line 46 def x509 @x509 ||= OpenSSL::X509::Certificate.new(as_pem) end