module TTTLS13::NamedGroup

Constants

SECP256R1
SECP384R1
SECP521R1

Public Class Methods

curve_name(group) click to toggle source

NOTE: SECG | ANSI X9.62 | NIST ————---------------————- secp256r1 | prime256v1 | NIST P-256 secp384r1 | | NIST P-384 secp521r1 | | NIST P-521

tools.ietf.org/html/rfc4492#appendix-A

@param groups [Array of TTTLS13::Message::Extension::NamedGroup]

@raise [TTTLS13::Error::ErrorAlerts]

@return [String] EC_builtin_curves

# File lib/tttls1.3/named_group.rb, line 74
def curve_name(group)
  case group
  when SECP256R1
    'prime256v1'
  when SECP384R1
    'secp384r1'
  when SECP521R1
    'secp521r1'
  else
    # not supported other NamedGroup
    raise Error::ErrorAlerts, :internal_error
  end
end
key_exchange_len(group) click to toggle source

NOTE: For secp256r1, secp384r1, and secp521r1

struct {
    uint8 legacy_form = 4;
    opaque X[coordinate_length];
    opaque Y[coordinate_length];
} UncompressedPointRepresentation;

@param group [TTTLS13::Message::Extension::NamedGroup]

@raise [TTTLS13::Error::ErrorAlerts]

@return [Integer]

# File lib/tttls1.3/named_group.rb, line 34
def key_exchange_len(group)
  case group
  when SECP256R1
    65
  when SECP384R1
    97
  when SECP521R1
    133
  # not supported other NamedGroup
  # when X25519
  #   32
  # when X448
  #   56
  # when FFDHE2048
  #   256
  # when FFDHE4096
  #   512
  # when FFDHE6144
  #   768
  # when FFDHE8192
  #   1024
  else
    raise Error::ErrorAlerts, :internal_error
  end
end