module TTTLS13::CipherSuite

Constants

TLS_AES_128_GCM_SHA256
TLS_AES_256_GCM_SHA384
TLS_CHACHA20_POLY1305_SHA256

Public Class Methods

auth_tag_len(cipher_suite) click to toggle source
# File lib/tttls1.3/cipher_suites.rb, line 61
def auth_tag_len(cipher_suite)
  case cipher_suite
  when TLS_AES_128_GCM_SHA256, TLS_AES_256_GCM_SHA384,
       TLS_CHACHA20_POLY1305_SHA256 # , TLS_AES_128_CCM_SHA256
    16
  # when TLS_AES_128_CCM_8_SHA256
  #   8
  else
    raise Error::ErrorAlerts, :internal_error
  end
end
digest(cipher_suite) click to toggle source
# File lib/tttls1.3/cipher_suites.rb, line 14
def digest(cipher_suite)
  case cipher_suite
  when TLS_AES_128_GCM_SHA256, TLS_CHACHA20_POLY1305_SHA256
    # , TLS_AES_128_CCM_SHA256, TLS_AES_128_CCM_8_SHA256
    'SHA256'
  when TLS_AES_256_GCM_SHA384
    'SHA384'
  else
    raise Error::ErrorAlerts, :internal_error
  end
end
hash_len(cipher_suite) click to toggle source
# File lib/tttls1.3/cipher_suites.rb, line 26
def hash_len(cipher_suite)
  case cipher_suite
  when TLS_AES_128_GCM_SHA256, TLS_CHACHA20_POLY1305_SHA256
    # , TLS_AES_128_CCM_SHA256, TLS_AES_128_CCM_8_SHA256
    32
  when TLS_AES_256_GCM_SHA384
    48
  else
    raise Error::ErrorAlerts, :internal_error
  end
end
iv_len(cipher_suite) click to toggle source
# File lib/tttls1.3/cipher_suites.rb, line 50
def iv_len(cipher_suite)
  case cipher_suite
  when TLS_AES_128_GCM_SHA256, TLS_AES_256_GCM_SHA384,
       TLS_CHACHA20_POLY1305_SHA256
    # , TLS_AES_128_CCM_SHA256, TLS_AES_128_CCM_8_SHA256
    12
  else
    raise Error::ErrorAlerts, :internal_error
  end
end
key_len(cipher_suite) click to toggle source
# File lib/tttls1.3/cipher_suites.rb, line 38
def key_len(cipher_suite)
  case cipher_suite
  when TLS_AES_128_GCM_SHA256
    # , TLS_AES_128_CCM_SHA256, TLS_AES_128_CCM_8_SHA256
    16
  when TLS_AES_256_GCM_SHA384, TLS_CHACHA20_POLY1305_SHA256
    32
  else
    raise Error::ErrorAlerts, :internal_error
  end
end