class TTTLS13::Transcript
Public Class Methods
new()
click to toggle source
Calls superclass method
# File lib/tttls1.3/transcript.rb, line 22 def initialize super end
Public Instance Methods
hash(digest, end_index)
click to toggle source
@param digest [String] name of digest algorithm @param end_index [Integer]
@return [String]
# File lib/tttls1.3/transcript.rb, line 32 def hash(digest, end_index) s = concat_messages(digest, end_index) OpenSSL::Digest.digest(digest, s) end
include?(key)
click to toggle source
# File lib/tttls1.3/transcript.rb, line 48 def include?(key) super_include?(key) && !self[key].nil? end
Also aliased as: super_include?
truncate_hash(digest, end_index, truncate_bytes)
click to toggle source
@param digest [String] name of digest algorithm @param end_index [Integer] @param truncate_bytes [Integer]
@return [String]
# File lib/tttls1.3/transcript.rb, line 42 def truncate_hash(digest, end_index, truncate_bytes) s = concat_messages(digest, end_index) truncated = s[0...-truncate_bytes] OpenSSL::Digest.digest(digest, truncated) end
Private Instance Methods
concat_messages(digest, end_index)
click to toggle source
@param digest [String] name of digest algorithm @param end_index [Integer]
@return [String]
# File lib/tttls1.3/transcript.rb, line 58 def concat_messages(digest, end_index) exc_prefix = '' if include?(HRR) # as an exception to the general rule exc_prefix = Message::HandshakeType::MESSAGE_HASH \ + "\x00\x00" \ + OpenSSL::Digest.new(digest).digest_length.to_uint8 \ + OpenSSL::Digest.digest(digest, self[CH1].serialize) \ + self[HRR].serialize end messages = (CH..end_index).to_a.map do |m| include?(m) ? self[m].serialize : '' end exc_prefix + messages.join end