Class: R509::Cert::Validator::OcspValidator

Inherits:
BasicValidator show all
Defined in:
lib/r509/cert/validator/ocsp_validator.rb

Instance Method Summary collapse

Methods inherited from BasicValidator

#initialize

Constructor Details

This class inherits a constructor from R509::Cert::Validator::BasicValidator

Instance Method Details

#available?Boolean

Returns:

  • (Boolean)


7
8
9
10
11
12
# File 'lib/r509/cert/validator/ocsp_validator.rb', line 7

def available?
  return false unless @issuer
  return false unless aia && aia.ocsp
  return false if ocsp_uris.empty?
  return true
end

#validate!Object



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/r509/cert/validator/ocsp_validator.rb', line 14

def validate!
  unless available?
    raise Error.new "Tried to validate OCSP but cert has no OCSP data"
  end
  
  uri = build_request_uri
  body = R509::OCSP::Response.parse(get(uri))
  
  check_ocsp_response body
  check_ocsp_payload body.basic.status.first
  return true
end