public class SupportedGroups extends SupportedEllipticCurves implements java.lang.Cloneable
SupportedGroups
(supported_groups) TLS extension as specified by RFC 7919, RFC 8446.
The SupportedGroups
(supported_groups) extension replaces
the SupportedEllipticCurves
(elliptic_curves) extension to
extend it about support for finite field based Diffie-Hellman (DH) key exchange
and hybrid ECC/KEM key exchange.
Although the [@link SupportedEllipticCurves SupportedEllipticCurves} class can
still be used for backwards compatibility to former iSaSiLk versions it is
recommended to use this SupportedGroups
implementation
instead of it.
In TLS 1.2 a SupportedGroups
extension might be sent by the client within
an extended ClientHello
message to tell the server which groups
are supported by the client when using an ECDHE or DHE based cipher suite. The server
uses the information sent by the client to select an ECC/DHE cipher suite in
accordance with the ECDHE/FFDHE groups supported by the client. The server
itself generally does not send a SupportedGroups
extension.
When TLS 1.3 is used the SupportGroups
extension is also sent by the client
to be used by the server for selecting a proper group to calculate the key_exchange
value for the KeyShare
extension.
TLS defines the SupportedGroups
extension as list of named
groups (see RFC 7919):
enum { Elliptic Curve Groups (ECDHE) secp256r1(0x0017), secp384r1(0x0018), secp521r1(0x0019), x25519(0x001D), x448(0x001E), // Finite Field Groups (DHE) ffdhe2048(0x0100), ffdhe3072(0x0101), ffdhe4096(0x0102), ffdhe6144(0x0103), ffdhe8192(0x0104), // Reserved Code Points ffdhe_private_use(0x01FC..0x01FF), ecdhe_private_use(0xFE00..0xFEFF), (0xFFFF) } NamedGroup; struct { NamedGroup named_group_list<2..2^16-1>; } NamedGroupList;The client shall send the list of supported groups in its preference order.
In addition to the elliptic groups listed above, iSaSiLk supports the following Brainpool groups from RFC 7027:
enum { brainpoolP256r1(26), brainpoolP384r1(27), brainpoolP512r1(28) } NamedGroup;iSaSiLk also supports the following hybrid groups combining a classical (ECC) and a PQ (ML-KEM) key exchange algorithm to protect key establishment in transition to post quantum cryptography (see Post-quantum hybrid ECDHE-MLKEM Key Agreement for TLSv1.3 and Hybrid key exchange in TLS 1.3:
enum { SecP256r1MLKEM768(0x11EB), X25519MLKEM768(0x11EC) } NamedGroup;
On the client side, when you create a SupportedGroups
extension
object you may explicitly
specify the
named groups to be included in preference order, e.g. (if you want to use
secp192r1
(NIST P-192) and
secp256r1
(NIST P-256) and prefer secp192r1):
// the list of supported elliptic groups NamedGroup[] ecList = { SupportedGroups.NC_PRIME_SECP192R1, SupportedGroups.NC_PRIME_SECP256R1 }; // create SupportedGroups extension SupportedGroups supportedGroups = new SupportedGroups(ecList); // add to ExtensionList ExtensionList extensions = new ExtensionList(); ... extensions.addExtension(supportedGroups); ... // set extensions for the SSLClientContext configuration: SSLClientContext clientContext = new SSLClientContext(); ... clientContext.setExtensions(extensions); ...Or you may use the
default
constructor which
creates a SupportedGroups
extension containing -- if
cryptographically supported -- secp256r1
,
secp384r1
, secp521r1
and x25519
as default elliptic group list and
ffdhe2048
and ffdhe3072
as
default FFDHE group list (in that order):
// create SupportedGroups extension SupportedGroups supportedGroups = new SupportedGroups(); // add to ExtensionList ExtensionList extensions = new ExtensionList(); ... extensions.addExtension(supportedGroups); ... // set extensions for the SSLClientContext configuration: SSLClientContext clientContext = new SSLClientContext(); ... clientContext.setExtensions(extensions); ...If the
critical
flag of a
client-side SupportedGroups
extension is set to true
the handshake will be aborted with an insufficient_security alert if the
server DHE key exchange message contains parameters (p, g) that do not comply
with any of the FFDHE parameters offered in the ClientHello SupportedGroups
extension.
On the server side the default constructor
may be used
to indicate support for the SupportedGroups
extension (the server
itself generally does not send a SupportedGroups
extension):
// create SupportedGroups extension SupportedGroups supportedGroups = new SupportedGroups(); // add to ExtensionList ExtensionList extensions = new ExtensionList(); ... extensions.addExtension(supportedGroups); ... // set extensions for the SSLServerContext configuration: SSLServerContext serverContext = new SSLServerContext(); ... serverContext.setExtensions(extensions); ...It is also possible to
explicitly
specify the named groups to be supported on the server side. In this case the
server side group list will be merged with the group list received from the
client. When having specified to
ignore
the preference order of
the client list the groups are merged in a way to prefer the group list order
of the server. If no common group can be found the client group list is
taken, except for when having marked this extension as being
critical
. In this case
the handshake will be aborted if client and server cannot agree on another
(non-ECC/DHE) suite. When using the default
constructor to create the a SupportedGroups extension on the server side the
critical
flag has no meaning.
Extension
,
ExtensionList
Modifier and Type | Class and Description |
---|---|
static class |
SupportedGroups.HybridKemGroup
Hybrid KEM Group.
|
static class |
SupportedGroups.KemGroup
KEM Group.
|
static class |
SupportedGroups.NamedFFDHEGroup
TLS NamedFFDHEGroup.
|
SupportedEllipticCurves.NamedCurve
Modifier and Type | Field and Description |
---|---|
static SupportedGroups.NamedFFDHEGroup |
FFDHE_2048
Named FFDHE group
ffdhe2048 (RFC 7919). |
static SupportedGroups.NamedFFDHEGroup |
FFDHE_3072
Named FFDHE group
ffdhe3072 (RFC 7919). |
static SupportedGroups.NamedFFDHEGroup |
FFDHE_4096
Named FFDHE group
ffdhe4096 (RFC 7919). |
static SupportedGroups.NamedFFDHEGroup |
FFDHE_6144
Named FFDHE group
ffdhe6144 (RFC 7919). |
static SupportedGroups.NamedFFDHEGroup |
FFDHE_8192
Named FFDHE group
ffdhe8192 (RFC 7919). |
static SupportedGroups.HybridKemGroup |
HYBRID_SecP256r1MLKEM768
Hybrid Kem group
SecP256r1MLKEM768 (https://datatracker.ietf.org/doc/draft-kwiatkowski-tls-ecdhe-mlkem/). |
static SupportedGroups.HybridKemGroup |
HYBRID_X25519MLKEM768
Hybrid Kem group
X25519MLKEM768 (https://datatracker.ietf.org/doc/draft-kwiatkowski-tls-ecdhe-mlkem/). |
static SupportedGroups.KemGroup |
mlkem1024
Kem group
MLKEM768 (https://datatracker.ietf.org/doc/draft-connolly-tls-mlkem-key-agreement/). |
static SupportedGroups.KemGroup |
mlkem512
Kem group
MLKEM512 (https://datatracker.ietf.org/doc/draft-connolly-tls-mlkem-key-agreement/). |
static SupportedGroups.KemGroup |
mlkem768
Kem group
MLKEM768 (https://datatracker.ietf.org/doc/draft-connolly-tls-mlkem-key-agreement/). |
NC_ARBITRARY_EXPLICIT_CHAR2, NC_ARBITRARY_EXPLICIT_PRIME, NC_CHAR2_SECT163K1, NC_CHAR2_SECT163R1, NC_CHAR2_SECT163R2, NC_CHAR2_SECT193R1, NC_CHAR2_SECT193R2, NC_CHAR2_SECT233K1, NC_CHAR2_SECT233R1, NC_CHAR2_SECT239K1, NC_CHAR2_SECT283K1, NC_CHAR2_SECT283R1, NC_CHAR2_SECT409K1, NC_CHAR2_SECT409R1, NC_CHAR2_SECT571K1, NC_CHAR2_SECT571R1, NC_PRIME_BRAINPOOLP256R1, NC_PRIME_BRAINPOOLP384R1, NC_PRIME_BRAINPOOLP512R1, NC_PRIME_SECP160K1, NC_PRIME_SECP160R1, NC_PRIME_SECP160R2, NC_PRIME_SECP192K1, NC_PRIME_SECP192R1, NC_PRIME_SECP224K1, NC_PRIME_SECP224R1, NC_PRIME_SECP256K1, NC_PRIME_SECP256R1, NC_PRIME_SECP384R1, NC_PRIME_SECP521R1, NC_X25519, NC_X448, TYPE
Constructor and Description |
---|
SupportedGroups()
Default Constructor.
|
SupportedGroups(NamedGroup[] namedGroupList)
Creates a SupportedGroups extension from the given group list.
|
SupportedGroups(NamedGroup[] namedGroupList,
boolean autoRemoveNotSupportedGroups)
Creates a SupportedGroups extension from the given group list.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Returns a clone of this SupportedGroups extension object.
|
SupportedEllipticCurves.NamedCurve |
getCurve(int id)
Checks whether the elliptic curve with the given id is included in this
SupportedEllipticCurves extension.
|
NamedGroup |
getGroup(int id)
Checks whether the group with the given id is included in this
SupportedGroups extension.
|
SupportedGroups.HybridKemGroup[] |
getHybridKemGroupList()
Gets the list of hybrid KEM groups included in this SupportedGroups
extension.
|
SupportedGroups.KemGroup[] |
getKemGroupList()
Gets the list of KEM groups included in this SupportedGroups
extension.
|
SupportedEllipticCurves.NamedCurve[] |
getNamedCurveList()
Gets the list of ECDHE groups included in this SupportedGroups
extension.
|
SupportedGroups.NamedFFDHEGroup[] |
getNamedFFDHEGroupList()
Gets the list of FFDHE groups included in this SupportedGroups
extension.
|
NamedGroup[] |
getNamedGroupList()
Gets the list of supported groups included in this SupportedGroups
extension.
|
static NamedGroup |
getRegisteredGroupByName(java.lang.String name)
Gets the registered named group with the given name.
|
java.lang.String |
toString()
Gets a String representation of this SupportedGroups object.
|
getAllRegisteredNamedCurves, getEllipticCurveList, getRegisteredCurveByID, getRegisteredCurveByName, getRegisteredCurveByOID, setIgnorePeerPreferenceOrder
getAllowedProtocolVersions, getExtensionType, getName, getType, setCritical
public static final SupportedGroups.NamedFFDHEGroup FFDHE_2048
ffdhe2048
(RFC 7919).
public static final SupportedGroups.NamedFFDHEGroup FFDHE_3072
ffdhe3072
(RFC 7919).
public static final SupportedGroups.NamedFFDHEGroup FFDHE_4096
ffdhe4096
(RFC 7919).
public static final SupportedGroups.NamedFFDHEGroup FFDHE_6144
ffdhe6144
(RFC 7919).
public static final SupportedGroups.NamedFFDHEGroup FFDHE_8192
ffdhe8192
(RFC 7919).
public static final SupportedGroups.KemGroup mlkem512
MLKEM512
(https://datatracker.ietf.org/doc/draft-connolly-tls-mlkem-key-agreement/).
public static final SupportedGroups.KemGroup mlkem768
MLKEM768
(https://datatracker.ietf.org/doc/draft-connolly-tls-mlkem-key-agreement/).
public static final SupportedGroups.KemGroup mlkem1024
MLKEM768
(https://datatracker.ietf.org/doc/draft-connolly-tls-mlkem-key-agreement/).
public static final SupportedGroups.HybridKemGroup HYBRID_X25519MLKEM768
X25519MLKEM768
(https://datatracker.ietf.org/doc/draft-kwiatkowski-tls-ecdhe-mlkem/).
public static final SupportedGroups.HybridKemGroup HYBRID_SecP256r1MLKEM768
SecP256r1MLKEM768
(https://datatracker.ietf.org/doc/draft-kwiatkowski-tls-ecdhe-mlkem/).
public SupportedGroups()
SupportedGroups
extension
containing -- if cryptographically supported -- secp256r1
,
secp384r1
, secp521r1
and
x25519
as default elliptic group list and ffdhe2048
and ffdhe3072
as default FFDHE group list (in that order).// create SupportedGroups extension SupportedGroups supportedGroups = new SupportedGroups(); // add to ExtensionList ExtensionList extensions = new ExtensionList(); ... extensions.addExtension(supportedGroups); ... // set extensions for the SSLClientContext configuration: SSLClientContext clientContext = new SSLClientContext(); ... clientContext.setExtensions(extensions); ...On the server side this constructor may be used to indicate support for the
SupportedGroups
extension only (the server itself does not send
a SupportedGroups
extension):
// create SupportedGroups extension SupportedGroups supportedGroups = new SupportedGroups(); // add to ExtensionList ExtensionList extensions = new ExtensionList(); ... extensions.addExtension(supportedGroups); ... // set extensions for the SSLServerContext configuration: SSLServerContext serverContext = new SSLServerContext(); ... serverContext.setExtensions(extensions); ...
public SupportedGroups(NamedGroup[] namedGroupList)
secp192r1
(NIST P-192) and
secp256r1
(NIST P-256) ECC groups and prefers
secp192r1 will configure the SSLClientContext with the following SupportedGroups
extension:
// the list of supported elliptic groups NamedGroup[] ecList = { SupportedGroups.NC_PRIME_SECP192R1, SupportedGroups.NC_PRIME_SECP256R1 }; // create SupportedGroups extension SupportedGroups supportedGroups = new SupportedGroups(ecList); // add to ExtensionList ExtensionList extensions = new ExtensionList(); ... extensions.addExtension(supportedGroups); ... // set extensions for the SSLClientContext configuration: SSLClientContext clientContext = new SSLClientContext(); ... clientContext.setExtensions(extensions); ...
namedGroupList
- the list of supported groups in preference order (the
namedGroupList
array is not cloned or copied by this
method)java.lang.IllegalArgumentException
- if the group list is empty or any of the given groups is not
supported by the installed cryptographic providerspublic SupportedGroups(NamedGroup[] namedGroupList, boolean autoRemoveNotSupportedGroups)
secp192r1
(NIST P-192) and
secp256r1
(NIST P-256) ECC groups and prefers
secp192r1 will configure the SSLClientContext with the following SupportedGroups
extension:
// the list of supported elliptic groups NamedGroup[] ecList = { SupportedGroups.NC_PRIME_SECP192R1, SupportedGroups.NC_PRIME_SECP256R1 }; // create SupportedGroups extension SupportedGroups supportedGroups = new SupportedGroups(ecList); // add to ExtensionList ExtensionList extensions = new ExtensionList(); ... extensions.addExtension(supportedGroups); ... // set extensions for the SSLClientContext configuration: SSLClientContext clientContext = new SSLClientContext(); ... clientContext.setExtensions(extensions); ...
namedGroupList
- the list of supported groups in preference order (the
namedGroupList
array is not cloned or copied by this
method)autoRemoveNotSupportedGroups
- whether to automatically remove any not supported
group (default: false
, if any of
the provided groups is not supported an
IllegalArgumentException is thrown)java.lang.IllegalArgumentException
- if the group list is empty or autoRemoveNotSupportedGroups
is set to false
(default) and any of the given groups is not
supported by the installed cryptographic providers or none of the
provided groups is supportedpublic static final NamedGroup getRegisteredGroupByName(java.lang.String name)
name
- the group namenull
otherwisepublic NamedGroup[] getNamedGroupList()
null
or empty if
no groups are included in the list (the returned array is not
cloned or copied by this method)public SupportedEllipticCurves.NamedCurve[] getNamedCurveList()
null
or empty if
no ECDHE groups are included in the list (the returned array is not
cloned or copied by this method)public SupportedGroups.NamedFFDHEGroup[] getNamedFFDHEGroupList()
null
or empty if
no FFDHE groups are included in the list (the returned array is not
cloned or copied by this method)public SupportedGroups.KemGroup[] getKemGroupList()
null
or empty if
no hybrid KEM groups are included in the list (the returned array is not
cloned or copied by this method)public SupportedGroups.HybridKemGroup[] getHybridKemGroupList()
null
or empty if
no hybrid KEM groups are included in the list (the returned array is not
cloned or copied by this method)public NamedGroup getGroup(int id)
id
- the TLS id of the group to be checkednull
if the group with the given id is not includedpublic java.lang.Object clone()
clone
in class SupportedEllipticCurves
public java.lang.String toString()
toString
in class SupportedEllipticCurves
public SupportedEllipticCurves.NamedCurve getCurve(int id)
getCurve
in class SupportedEllipticCurves
id
- the TLS id of the curve to be checkednull
if the curve with the given id is not included