Class: Ronin::Recon::Values::Cert
- Inherits:
-
Ronin::Recon::Value
- Object
- Ronin::Recon::Value
- Ronin::Recon::Values::Cert
- Defined in:
- lib/ronin/recon/values/cert.rb
Overview
Represents a SSL/TLS certificate.
Instance Attribute Summary collapse
-
#cert ⇒ Ronin::Support::Crypto::Cert
readonly
private
The certificate object.
Class Method Summary collapse
-
.value_type ⇒ :cert
private
Returns the type or kind of recon value.
Instance Method Summary collapse
-
#as_json ⇒ Hash{Symbol => Object}
Converts the certificate to a hash of attributes.
-
#eql?(other) ⇒ Boolean
Compares the certificate to another value.
-
#extensions ⇒ Array<OpenSSL::X509::Extensions>
Additional certificate extensions.
-
#hash ⇒ Integer
The "hash" value of the certificate.
-
#initialize(cert) ⇒ Cert
constructor
Initializes the certificate value.
-
#issuer ⇒ OpenSSL::X509::Name
The certificate issuer's information.
-
#not_after ⇒ Time
When the certificate expires.
-
#not_before ⇒ Time
When the certificate begins being valid.
-
#serial ⇒ OpenSSL::BN
The serial number of the SSL/TLS certificate.
-
#subject ⇒ OpenSSL::X509::Name
The certificate subject's information.
-
#to_s ⇒ String
Converts the certificate to a string.
Methods inherited from Ronin::Recon::Value
Constructor Details
#initialize(cert) ⇒ Cert
Initializes the certificate value.
45 46 47 |
# File 'lib/ronin/recon/values/cert.rb', line 45 def initialize(cert) @cert = Support::Crypto::Cert(cert) end |
Instance Attribute Details
#cert ⇒ Ronin::Support::Crypto::Cert (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The certificate object.
37 38 39 |
# File 'lib/ronin/recon/values/cert.rb', line 37 def cert @cert end |
Class Method Details
.value_type ⇒ :cert
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This is used internally to map a recon value class to a printable type.
Returns the type or kind of recon value.
161 162 163 |
# File 'lib/ronin/recon/values/cert.rb', line 161 def self.value_type :cert end |
Instance Method Details
#as_json ⇒ Hash{Symbol => Object}
Converts the certificate to a hash of attributes
137 138 139 140 141 142 143 144 145 146 147 148 |
# File 'lib/ronin/recon/values/cert.rb', line 137 def as_json { serial: @cert.serial, not_before: @cert.not_before, not_after: @cert.not_after, subject: @cert.subject.to_h, issuer: @cert.issuer.to_h, extensions: @cert.extensions_hash, subject_alt_names: @cert.subject_alt_names, pem: @cert.to_pem } end |
#eql?(other) ⇒ Boolean
Compares the certificate to another value.
110 111 112 |
# File 'lib/ronin/recon/values/cert.rb', line 110 def eql?(other) self.class == other.class && serial == other.serial end |
#extensions ⇒ Array<OpenSSL::X509::Extensions>
Additional certificate extensions.
99 100 101 |
# File 'lib/ronin/recon/values/cert.rb', line 99 def extensions @cert.extensions end |
#hash ⇒ Integer
The "hash" value of the certificate.
119 120 121 |
# File 'lib/ronin/recon/values/cert.rb', line 119 def hash [self.class, @cert.serial].hash end |
#issuer ⇒ OpenSSL::X509::Name
The certificate issuer's information.
81 82 83 |
# File 'lib/ronin/recon/values/cert.rb', line 81 def issuer @cert.issuer end |
#not_after ⇒ Time
When the certificate expires.
72 73 74 |
# File 'lib/ronin/recon/values/cert.rb', line 72 def not_after @cert.not_after end |
#not_before ⇒ Time
When the certificate begins being valid.
63 64 65 |
# File 'lib/ronin/recon/values/cert.rb', line 63 def not_before @cert.not_before end |
#serial ⇒ OpenSSL::BN
The serial number of the SSL/TLS certificate.
54 55 56 |
# File 'lib/ronin/recon/values/cert.rb', line 54 def serial @cert.serial end |
#subject ⇒ OpenSSL::X509::Name
The certificate subject's information.
90 91 92 |
# File 'lib/ronin/recon/values/cert.rb', line 90 def subject @cert.subject end |
#to_s ⇒ String
Converts the certificate to a string.
128 129 130 |
# File 'lib/ronin/recon/values/cert.rb', line 128 def to_s @cert.to_s end |