Class: TTTLS13::Message::Extension::Cookie
- Inherits:
-
Object
- Object
- TTTLS13::Message::Extension::Cookie
- Defined in:
- lib/tttls1.3/message/extension/cookie.rb
Instance Attribute Summary collapse
-
#cookie ⇒ Object
readonly
Returns the value of attribute cookie.
-
#extension_type ⇒ Object
readonly
Returns the value of attribute extension_type.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(cookie) ⇒ Cookie
constructor
A new instance of Cookie.
- #serialize ⇒ String
Constructor Details
#initialize(cookie) ⇒ Cookie
Returns a new instance of Cookie.
15 16 17 18 19 20 |
# File 'lib/tttls1.3/message/extension/cookie.rb', line 15 def initialize() @extension_type = ExtensionType::COOKIE @cookie = || '' raise Error::ErrorAlerts, :internal_error \ if @cookie.length > 2**16 - 3 end |
Instance Attribute Details
#cookie ⇒ Object (readonly)
Returns the value of attribute cookie.
10 11 12 |
# File 'lib/tttls1.3/message/extension/cookie.rb', line 10 def @cookie end |
#extension_type ⇒ Object (readonly)
Returns the value of attribute extension_type.
9 10 11 |
# File 'lib/tttls1.3/message/extension/cookie.rb', line 9 def extension_type @extension_type end |
Class Method Details
.deserialize(binary) ⇒ TTTLS13::Message::Extensions::Cookie?
32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/tttls1.3/message/extension/cookie.rb', line 32 def self.deserialize(binary) raise Error::ErrorAlerts, :internal_error if binary.nil? return nil if binary.length < 2 = Convert.bin2i(binary.slice(0, 2)) = binary.slice(2, ) return nil unless + 2 == binary.length && <= 2**16 - 3 Cookie.new() end |
Instance Method Details
#serialize ⇒ String
23 24 25 |
# File 'lib/tttls1.3/message/extension/cookie.rb', line 23 def serialize @extension_type + @cookie.prefix_uint16_length.prefix_uint16_length end |