Class: CertValidator::RealOcspValidator
- Inherits:
-
Object
- Object
- CertValidator::RealOcspValidator
- Includes:
- OcspFailures
- Defined in:
- lib/cert_validator/ocsp/extractor.rb,
lib/cert_validator/ocsp/real_validator.rb
Defined Under Namespace
Classes: Extractor
Instance Attribute Summary collapse
-
#ca ⇒ Object
readonly
Returns the value of attribute ca.
-
#certificate ⇒ Object
readonly
Returns the value of attribute certificate.
-
#logger ⇒ Object
Returns the value of attribute logger.
Instance Method Summary collapse
- #available? ⇒ Boolean
-
#initialize(cert, ca) ⇒ RealOcspValidator
constructor
A new instance of RealOcspValidator.
- #valid? ⇒ Boolean
- #validate! ⇒ Object
Constructor Details
#initialize(cert, ca) ⇒ RealOcspValidator
Returns a new instance of RealOcspValidator.
14 15 16 17 18 19 |
# File 'lib/cert_validator/ocsp/real_validator.rb', line 14 def initialize(cert, ca) @certificate = cert @ca = ca @extractor = Extractor.new @certificate end |
Instance Attribute Details
#ca ⇒ Object (readonly)
Returns the value of attribute ca.
9 10 11 |
# File 'lib/cert_validator/ocsp/real_validator.rb', line 9 def ca @ca end |
#certificate ⇒ Object (readonly)
Returns the value of attribute certificate.
8 9 10 |
# File 'lib/cert_validator/ocsp/real_validator.rb', line 8 def certificate @certificate end |
#logger ⇒ Object
Returns the value of attribute logger.
10 11 12 |
# File 'lib/cert_validator/ocsp/real_validator.rb', line 10 def logger @logger end |
Instance Method Details
#available? ⇒ Boolean
21 22 23 |
# File 'lib/cert_validator/ocsp/real_validator.rb', line 21 def available? @extractor.has_ocsp_extension? end |
#valid? ⇒ Boolean
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/cert_validator/ocsp/real_validator.rb', line 25 def valid? return false unless available? begin validate! rescue => e log e return false end return true end |
#validate! ⇒ Object
38 39 40 41 42 43 44 45 |
# File 'lib/cert_validator/ocsp/real_validator.rb', line 38 def validate! raise FetchError.new unless http_body = fetch(request_uri) body = OpenSSL::OCSP::Response.new http_body check_ocsp_response body check_ocsp_payload body.basic.status.first end |