Class: TTTLS13::Message::Extension::EarlyDataIndication
- Inherits:
-
Object
- Object
- TTTLS13::Message::Extension::EarlyDataIndication
- Defined in:
- lib/tttls1.3/message/extension/early_data_indication.rb
Instance Attribute Summary collapse
-
#extension_type ⇒ Object
readonly
Returns the value of attribute extension_type.
-
#max_early_data_size ⇒ Object
readonly
Returns the value of attribute max_early_data_size.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(max_early_data_size = nil) ⇒ EarlyDataIndication
constructor
A new instance of EarlyDataIndication.
- #serialize ⇒ String
Constructor Details
#initialize(max_early_data_size = nil) ⇒ EarlyDataIndication
Returns a new instance of EarlyDataIndication.
15 16 17 18 19 20 |
# File 'lib/tttls1.3/message/extension/early_data_indication.rb', line 15 def initialize(max_early_data_size = nil) @extension_type = ExtensionType::EARLY_DATA @max_early_data_size = max_early_data_size raise Error::ErrorAlerts, :internal_error \ unless @max_early_data_size.nil? || @max_early_data_size < 2**32 end |
Instance Attribute Details
#extension_type ⇒ Object (readonly)
Returns the value of attribute extension_type.
9 10 11 |
# File 'lib/tttls1.3/message/extension/early_data_indication.rb', line 9 def extension_type @extension_type end |
#max_early_data_size ⇒ Object (readonly)
Returns the value of attribute max_early_data_size.
10 11 12 |
# File 'lib/tttls1.3/message/extension/early_data_indication.rb', line 10 def max_early_data_size @max_early_data_size end |
Class Method Details
.deserialize(binary, msg_type) ⇒ TTTLS13::Message::Extensions::EarlyDataIndication?
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/tttls1.3/message/extension/early_data_indication.rb', line 37 def self.deserialize(binary, msg_type) raise Error::ErrorAlerts, :internal_error if binary.nil? case msg_type when HandshakeType::CLIENT_HELLO, HandshakeType::ENCRYPTED_EXTENSIONS return nil unless binary.empty? max_early_data_size = nil when HandshakeType::NEW_SESSION_TICKET return nil unless binary.length == 4 max_early_data_size = Convert.bin2i(binary) else raise Error::ErrorAlerts, :internal_error end EarlyDataIndication.new(max_early_data_size) end |
Instance Method Details
#serialize ⇒ String
23 24 25 26 27 28 29 |
# File 'lib/tttls1.3/message/extension/early_data_indication.rb', line 23 def serialize binary = '' binary = @max_early_data_size.to_uint32 \ unless @max_early_data_size.nil? @extension_type + binary.prefix_uint16_length end |