Skip to content

End of Life Ruby 3.2 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

OpenSSL::OCSP::SingleResponse#check_validity

single_response.check_validity(nsec = 0, maxsec = -1) → true | false

Checks the validity of thisUpdate and nextUpdate fields of this SingleResponse. This checks the current time is within the range thisUpdate to nextUpdate.

It is possible that the OCSP request takes a few seconds or the time is not accurate. To avoid rejecting a valid response, this method allows the times to be within nsec seconds of the current time.

Some responders don’t set the nextUpdate field. This may cause a very old response to be considered valid. The maxsec parameter can be used to limit the age of responses.

See also #cert_status #extensions #certid #initialize_copy also in 4.1 · 4.0 · 3.4 · 3.3 · 3.1 · 3.0