Class: R509::Validity::Status
- Inherits:
-
Object
- Object
- R509::Validity::Status
- Defined in:
- lib/r509/validity.rb
Overview
data about the status of a certificate
Instance Attribute Summary collapse
-
#revocation_reason ⇒ Object
readonly
Returns the value of attribute revocation_reason.
-
#revocation_time ⇒ Object
readonly
Returns the value of attribute revocation_time.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Status
constructor
A new instance of Status.
-
#ocsp_status ⇒ OpenSSL::OCSP::STATUS
OpenSSL status constants when passing R509 constants.
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( = {}) @status = [:status] @revocation_time = [:revocation_time] || nil @revocation_reason = [:revocation_reason] || 0 if @status == R509::Validity::REVOKED && @revocation_time.nil? @revocation_time = Time.now.to_i end end |
Instance Attribute Details
#revocation_reason ⇒ Object (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_time ⇒ Object (readonly)
Returns the value of attribute revocation_time
15 16 17 |
# File 'lib/r509/validity.rb', line 15 def revocation_time @revocation_time end |
#status ⇒ Object (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_status ⇒ OpenSSL::OCSP::STATUS
Returns 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 |