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.
123 124 125 126 |
# File 'lib/tttls1.3/message/extension/status_request.rb', line 123 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.
114 115 116 |
# File 'lib/tttls1.3/message/extension/status_request.rb', line 114 def extension_type @extension_type end |
#ocsp_response ⇒ Object (readonly)
Returns the value of attribute ocsp_response.
115 116 117 |
# File 'lib/tttls1.3/message/extension/status_request.rb', line 115 def ocsp_response @ocsp_response end |
Class Method Details
.deserialize(binary) ⇒ TTTLS13::Message::Extension::OCSPResponse?
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
# File 'lib/tttls1.3/message/extension/status_request.rb', line 142 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
129 130 131 132 133 134 135 |
# File 'lib/tttls1.3/message/extension/status_request.rb', line 129 def serialize binary = '' binary += CertificateStatusType::OCSP binary += @ocsp_response.to_der.prefix_uint24_length @extension_type + binary.prefix_uint16_length end |