Class: TTTLS13::Message::Extension::OCSPResponse
- Inherits:
-
Object
- Object
- TTTLS13::Message::Extension::OCSPResponse
- Defined in:
- lib/tttls1.3/message/extension/status_request.rb
Instance Attribute Summary collapse
-
#extension_type ⇒ Object
readonly
Returns the value of attribute extension_type.
-
#ocsp_response ⇒ Object
readonly
Returns the value of attribute ocsp_response.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(ocsp_response) ⇒ OCSPResponse
constructor
A new instance of OCSPResponse.
- #serialize ⇒ String
Constructor Details
#initialize(ocsp_response) ⇒ OCSPResponse
Returns a new instance of OCSPResponse.
115 116 117 118 |
# File 'lib/tttls1.3/message/extension/status_request.rb', line 115 def initialize(ocsp_response) @extension_type = ExtensionType::STATUS_REQUEST @ocsp_response = ocsp_response end |
Instance Attribute Details
#extension_type ⇒ Object (readonly)
Returns the value of attribute extension_type.
107 108 109 |
# File 'lib/tttls1.3/message/extension/status_request.rb', line 107 def extension_type @extension_type end |
#ocsp_response ⇒ Object (readonly)
Returns the value of attribute ocsp_response.
107 108 109 |
# File 'lib/tttls1.3/message/extension/status_request.rb', line 107 def ocsp_response @ocsp_response end |
Class Method Details
.deserialize(binary) ⇒ TTTLS13::Message::Extension::OCSPResponse?
134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 |
# File 'lib/tttls1.3/message/extension/status_request.rb', line 134 def self.deserialize(binary) raise Error::ErrorAlerts, :internal_error if binary.nil? return nil if binary.length < 4 || binary[0] != CertificateStatusType::OCSP res_len = Convert.bin2i(binary.slice(1, 3)) res = binary.slice(4, res_len) ocsp_response = nil begin ocsp_response = OpenSSL::OCSP::Response.new(res) rescue OpenSSL::OCSP::OCSPError return nil end return nil if 4 + res_len != binary.length OCSPResponse.new(ocsp_response) end |
Instance Method Details
#serialize ⇒ String
121 122 123 124 125 126 127 |
# File 'lib/tttls1.3/message/extension/status_request.rb', line 121 def serialize binary = '' binary += CertificateStatusType::OCSP binary += @ocsp_response.to_der.prefix_uint24_length @extension_type + binary.prefix_uint16_length end |