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

- (Status) initialize(options = {})

A new instance of Status



14
15
16
17
18
19
20
21
22
# File 'lib/r509/validity.rb', line 14

def initialize(options={})
    @status = options[:status]
    @revocation_time = options[:revocation_time] || nil
    @revocation_reason = options[:revocation_reason] || 0

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

Instance Attribute Details

- (Object) revocation_reason (readonly)

Returns the value of attribute revocation_reason



12
13
14
# File 'lib/r509/validity.rb', line 12

def revocation_reason
  @revocation_reason
end

- (Object) revocation_time (readonly)

Returns the value of attribute revocation_time



12
13
14
# File 'lib/r509/validity.rb', line 12

def revocation_time
  @revocation_time
end

- (Object) status (readonly)

Returns the value of attribute status



12
13
14
# File 'lib/r509/validity.rb', line 12

def status
  @status
end

Instance Method Details

- (OpenSSL::OCSP::STATUS) ocsp_status

OpenSSL status constants when passing R509 constants

Returns:

  • (OpenSSL::OCSP::STATUS)

    OpenSSL status constants when passing R509 constants



25
26
27
28
29
30
31
32
33
34
35
36
# File 'lib/r509/validity.rb', line 25

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