Module: TTTLS13::NamedGroup

Defined in:
lib/tttls1.3/named_group.rb

Constant Summary collapse

SECP256R1 =
"\x00\x17"
SECP384R1 =
"\x00\x18"
SECP521R1 =
"\x00\x19"

Class Method Summary collapse

Class Method Details

.curve_name(group) ⇒ String

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

Parameters:

  • groups (Array of TTTLS13::Message::Extension::NamedGroup)

Returns:

  • (String)

    EC_builtin_curves

Raises:



74
75
76
77
78
79
80
81
82
83
84
85
86
# 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) ⇒ Integer

NOTE: For secp256r1, secp384r1, and secp521r1

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

Parameters:

  • group (TTTLS13::Message::Extension::NamedGroup)

Returns:

  • (Integer)

Raises:



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# 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