Class: R509::Validity::Status

Inherits:
Object
  • Object
show all
Defined in:
lib/r509/validity.rb

Overview

data about the status of a certificate

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Status

Returns a new instance of Status



17
18
19
20
21
22
23
24
25
# 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

Instance Attribute Details

#revocation_reasonObject (readonly)

Returns the value of attribute revocation_reason



15
16
17
# File 'lib/r509/validity.rb', line 15

def revocation_reason
  @revocation_reason
end

#revocation_timeObject (readonly)

Returns the value of attribute revocation_time



15
16
17
# File 'lib/r509/validity.rb', line 15

def revocation_time
  @revocation_time
end

#statusObject (readonly)

Returns the value of attribute status



15
16
17
# File 'lib/r509/validity.rb', line 15

def status
  @status
end

Instance Method Details

#ocsp_statusOpenSSL::OCSP::STATUS

Returns OpenSSL status constants when passing R509 constants

Returns:

  • (OpenSSL::OCSP::STATUS)

    OpenSSL status constants when passing R509 constants



29
30
31
32
33
34
35
36
37
38
39
40
# 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