class R509::Validity::Status

data about the status of a certificate

Attributes

revocation_reason[R]
revocation_time[R]
status[R]

Public Class Methods

new(options = {}) click to toggle source
# File lib/r509/validity.rb, line 17
def initialize(options = {})
  @status = options[:status]
  @revocation_time = options[:revocation_time] || nil
  @revocation_reason = options[:revocation_reason] || 0

  if @status == R509::Validity::REVOKED && @revocation_time.nil?
    @revocation_time = Time.now.to_i
  end
end

Public Instance Methods

ocsp_status() click to toggle source

@return [OpenSSL::OCSP::STATUS] OpenSSL status constants when passing

R509 constants
# File lib/r509/validity.rb, line 29
def ocsp_status
  case @status
  when R509::Validity::VALID
    OpenSSL::OCSP::V_CERTSTATUS_GOOD
  when R509::Validity::REVOKED
    OpenSSL::OCSP::V_CERTSTATUS_REVOKED
  when R509::Validity::UNKNOWN
    OpenSSL::OCSP::V_CERTSTATUS_UNKNOWN
  else
    OpenSSL::OCSP::V_CERTSTATUS_UNKNOWN
  end
end