Class: SSLyze::XML::Certinfo::Certificate
- Inherits:
-
Object
- Object
- SSLyze::XML::Certinfo::Certificate
- Defined in:
- lib/sslyze/xml/certinfo/certificate.rb,
lib/sslyze/xml/certinfo/certificate/public_key.rb
Overview
Represents the <certificate>
XML element.
Defined Under Namespace
Classes: PublicKey
OpenSSL Methods collapse
-
#==(other) ⇒ Boolean
Compares the other certificiate to this certificate.
- #extensions ⇒ X509::ExtensionSet
-
#hpkp_sha256_pin ⇒ String
The HPKP SHA256 Pin.
- #issuer ⇒ X509::Name
- #not_after ⇒ Time
- #not_before ⇒ Time
- #public_key ⇒ PublicKey
- #serial ⇒ OpenSSL::BN
-
#sha1_fingerprint ⇒ String
The SHA1 fingerprint of the cert.
- #signature_algorithm ⇒ String
- #subject ⇒ X509::Name
-
#supplied_server_name_indication ⇒ String
The supplied server name indication.
- #to_der ⇒ String
- #to_text ⇒ String
- #version ⇒ Integer
Instance Method Summary collapse
-
#as_pem ⇒ String
(also: #to_s)
The AS PEM information.
-
#initialize(node) ⇒ Certificate
constructor
Initializes the certificate.
-
#x509 ⇒ OpenSSL::X509::Certificate
The parsed X509 certificate.
Constructor Details
#initialize(node) ⇒ Certificate
Initializes the certificate.
22 23 24 |
# File 'lib/sslyze/xml/certinfo/certificate.rb', line 22 def initialize(node) @node = node end |
Instance Method Details
#==(other) ⇒ Boolean
Compares the other certificiate to this certificate.
195 196 197 |
# File 'lib/sslyze/xml/certinfo/certificate.rb', line 195 def ==(other) other.kind_of?(self.class) && other.as_pem == as_pem end |
#as_pem ⇒ String Also known as: to_s
The AS PEM information.
31 32 33 |
# File 'lib/sslyze/xml/certinfo/certificate.rb', line 31 def as_pem @as_pem ||= @node.at_xpath('asPEM').inner_text end |
#extensions ⇒ X509::ExtensionSet
55 56 57 |
# File 'lib/sslyze/xml/certinfo/certificate.rb', line 55 def extensions X509::ExtensionSet.new(x509.extensions) end |
#hpkp_sha256_pin ⇒ String
The HPKP SHA256 Pin.
169 170 171 |
# File 'lib/sslyze/xml/certinfo/certificate.rb', line 169 def hpkp_sha256_pin @hpkp_sha256_pin ||= @node['hpkpSha256Pin'] end |
#issuer ⇒ X509::Name
66 67 68 |
# File 'lib/sslyze/xml/certinfo/certificate.rb', line 66 def issuer @issuer ||= X509::Name.new(x509.issuer) end |
#not_after ⇒ Time
75 76 77 |
# File 'lib/sslyze/xml/certinfo/certificate.rb', line 75 def not_after x509.not_after end |
#not_before ⇒ Time
84 85 86 |
# File 'lib/sslyze/xml/certinfo/certificate.rb', line 84 def not_before x509.not_before end |
#public_key ⇒ PublicKey
93 94 95 |
# File 'lib/sslyze/xml/certinfo/certificate.rb', line 93 def public_key @public_key ||= PublicKey.new(@node.at_xpath('publicKey')) end |
#serial ⇒ OpenSSL::BN
104 105 106 |
# File 'lib/sslyze/xml/certinfo/certificate.rb', line 104 def serial x509.serial end |
#sha1_fingerprint ⇒ String
The SHA1 fingerprint of the cert.
158 159 160 |
# File 'lib/sslyze/xml/certinfo/certificate.rb', line 158 def sha1_fingerprint @sha1_fingerprint ||= @node['sha1Fingerprint'] end |
#signature_algorithm ⇒ String
113 114 115 |
# File 'lib/sslyze/xml/certinfo/certificate.rb', line 113 def signature_algorithm x509.signature_algorithm end |
#subject ⇒ X509::Name
122 123 124 |
# File 'lib/sslyze/xml/certinfo/certificate.rb', line 122 def subject @subject ||= X509::Name.new(x509.subject) end |
#supplied_server_name_indication ⇒ String
The supplied server name indication.
180 181 182 |
# File 'lib/sslyze/xml/certinfo/certificate.rb', line 180 def supplied_server_name_indication @supplied_server_name_indication ||= @node['suppliedServerNameIndication'] end |
#to_der ⇒ String
131 132 133 |
# File 'lib/sslyze/xml/certinfo/certificate.rb', line 131 def to_der x509.to_der end |
#to_text ⇒ String
140 141 142 |
# File 'lib/sslyze/xml/certinfo/certificate.rb', line 140 def to_text x509.to_text end |
#version ⇒ Integer
149 150 151 |
# File 'lib/sslyze/xml/certinfo/certificate.rb', line 149 def version x509.version end |
#x509 ⇒ OpenSSL::X509::Certificate
The parsed X509 certificate.
46 47 48 |
# File 'lib/sslyze/xml/certinfo/certificate.rb', line 46 def x509 @x509 ||= OpenSSL::X509::Certificate.new(as_pem) end |