Class: TTTLS13::Message::Finished

Inherits:
Object
  • Object
show all
Defined in:
lib/tttls1.3/message/finished.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(verify_data) ⇒ Finished

Returns a new instance of Finished.

Parameters:

  • verify_data (String)


12
13
14
15
# File 'lib/tttls1.3/message/finished.rb', line 12

def initialize(verify_data)
  @msg_type = HandshakeType::FINISHED
  @verify_data = verify_data
end

Instance Attribute Details

#msg_typeObject (readonly)

Returns the value of attribute msg_type.



8
9
10
# File 'lib/tttls1.3/message/finished.rb', line 8

def msg_type
  @msg_type
end

#verify_dataObject (readonly)

Returns the value of attribute verify_data.



9
10
11
# File 'lib/tttls1.3/message/finished.rb', line 9

def verify_data
  @verify_data
end

Class Method Details

.deserialize(binary) ⇒ TTTLS13::Message::Finished

Parameters:

  • binary (String)

Returns:

Raises:



29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/tttls1.3/message/finished.rb', line 29

def self.deserialize(binary)
  raise Error::ErrorAlerts, :internal_error if binary.nil?
  raise Error::ErrorAlerts, :decode_error if binary.length < 4
  raise Error::ErrorAlerts, :internal_error \
    unless binary[0] == HandshakeType::FINISHED

  msg_len = Convert.bin2i(binary.slice(1, 3))
  verify_data = binary.slice(4, msg_len)
  raise Error::ErrorAlerts, :decode_error \
    unless msg_len + 4 == binary.length

  Finished.new(verify_data)
end

Instance Method Details

#serializeString Also known as: fragment

Returns:

  • (String)


18
19
20
# File 'lib/tttls1.3/message/finished.rb', line 18

def serialize
  @msg_type + @verify_data.prefix_uint24_length
end