public class SupportedPointFormats extends Extension implements java.lang.Cloneable
SupportedPointFormats
(ec_point_formats) TLS extension as specified by RFC 4492.
A SupportedPointFormats
extension might be sent
by client or server to tell the peer which point formats are
supported when using an ECC based cipher suite.
TLS defines the SupportedPointFormats
extension as
list of elliptic point formats (see RFC 4492):
enum { uncompressed (0), ansiX962_compressed_prime (1), ansiX962_compressed_char2 (2), reserved (248..255) } ECPointFormat; struct { ECPointFormat ec_point_format_list<1..2^8-1> } ECPointFormatList;The list of supported point formats shall be sent in the client's/server's preference order. The
uncompressed
point format must be supported by any TLS application that supports
this extension. If no SupportedPointsFormat
extension
is sent, the uncompressed
format has to be used.
When creating a SupportedPointFormats
extension object you may
explicitly
specify the point
formats to be included in preference order, e.g. (if you support prime and
characteristic-2 fields and prefer the compressed
format for prime fields but the uncompressed
format
over the compressed
for characteristic-2 fields):
// the list of supported elliptic point formats ECPointFormat[] pfList = { SupportedPointFormats.PF_COMPRESSED_PRIME, SupportedPointFormats.PF_UNCOMPRESSED, SupportedPointFormats.PF_COMPRESSED_CHAR2}; // create SupportedPointFormats extension SupportedPointFormats supportedPointFormats = new SupportedPointFormats(pfList); // add to ExtensionList ExtensionList extensions = new ExtensionList(); ... extensions.addExtension(supportedPointFormats); ... // set extensions for the SSLContext configuration: SSLContext context = ...; ... context.setExtensions(extensions); ...Or you may use the
default
constructor
which creates a SupportedPointFormats
extension indicating
support for the default uncompressed
point format:
// create SupportedPointFormats extension SupportedPointFormats supportedPointFormats = new SupportedPointFormats(); // add to ExtensionList ExtensionList extensions = new ExtensionList(); ... extensions.addExtension(supportedPointFormats); ... // set extensions for the SSLContext configuration: SSLContext context = ...; ... context.setExtensions(extensions); ...In contrast to other client-side extensions the
critical
flag
of a client-side ec_point_formats extension is set to false
by default. If you set the critical
flag of a client-side ec_point_formats extension to true
, the
handshake will be aborted if the server does not send an ec_point_formats
extension in response to an ec_point_formats sent by the client.
If you set the
flag of a server-side ec_point_formats extension to critical
true
, the
handshake will be aborted if the client does not send an ec_point_formats
extension within the extended ClientHello message.
Extension
,
ExtensionList
Modifier and Type | Class and Description |
---|---|
static class |
SupportedPointFormats.ECPointFormat
TLS ECC PointFormat.
|
Modifier and Type | Field and Description |
---|---|
static SupportedPointFormats.ECPointFormat |
PF_COMPRESSED_CHAR2
ECC point format
ansiX962_compressed_char2 (2). |
static SupportedPointFormats.ECPointFormat |
PF_COMPRESSED_PRIME
ECC point format
ansiX962_compressed_prime (1). |
static SupportedPointFormats.ECPointFormat |
PF_UNCOMPRESSED
ECC point format
uncompressed (0). |
static ExtensionType |
TYPE
The type (11) of the ec_point_formats extension.
|
Constructor and Description |
---|
SupportedPointFormats()
Default Constructor.
|
SupportedPointFormats(SupportedPointFormats.ECPointFormat[] pointFormats)
Creates a SupportedPointFormats extension from the given elliptic
point format list.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Returns a clone of this SupportedPointFormats extension object.
|
SupportedPointFormats.ECPointFormat |
getPointFormat(int id)
Checks whether the point format with the given id is included in this
SupportedPointFormats extension.
|
SupportedPointFormats.ECPointFormat[] |
getPointFormatList()
Gets the list of supported point formats included in this SupportedPointFormats extension.
|
java.lang.String |
toString()
Gets a String representation of this SupportedPointFormats object.
|
getAllowedProtocolVersions, getExtensionType, getName, getType, setCritical
public static final ExtensionType TYPE
public static final SupportedPointFormats.ECPointFormat PF_UNCOMPRESSED
uncompressed
(0).
Must be supported by any TLS implementation that supports this extension.
public static final SupportedPointFormats.ECPointFormat PF_COMPRESSED_PRIME
ansiX962_compressed_prime
(1).
Used with prime curves only.
public static final SupportedPointFormats.ECPointFormat PF_COMPRESSED_CHAR2
ansiX962_compressed_char2
(2).
Used with characteristic-2 curves only.
public SupportedPointFormats()
SupportedPointFormats
extension indicating support for the default uncompressed
point format.
// create SupportedPointFormats extension SupportedPointFormats supportedPointFormats = new SupportedPointFormats(); // add to ExtensionList ExtensionList extensions = new ExtensionList(); ... extensions.addExtension(supportedPointFormats); ... // set extensions for the SSLContext configuration: SSLContext context = ...; ... context.setExtensions(extensions); ...
public SupportedPointFormats(SupportedPointFormats.ECPointFormat[] pointFormats)
compressed
format for prime
fields but the uncompressed
format over the
compressed
for characteristic-2 fields):
// the list of supported elliptic point formats ECPointFormat[] pfList = { SupportedPointFormats.PF_COMPRESSED_PRIME, SupportedPointFormats.PF_UNCOMPRESSED, SupportedPointFormats.PF_COMPRESSED_CHAR2}; // create SupportedPointFormats extension SupportedPointFormats supportedPointFormats = new SupportedPointFormats(pfList); // add to ExtensionList ExtensionList extensions = new ExtensionList(); ... extensions.addExtension(supportedPointFormats); ... // set extensions for the SSLContext configuration: SSLContext context = ...; ... context.setExtensions(extensions); ...
pointFormats
- the list of supported point formats in preference order
(the pointFormats
array is not cloned or copied by this method)java.lang.IllegalArgumentException
- if the point format list is empty or does
not contain the uncompressed point format
or does contain a point format that is not
supported by the installed cryptographic
providerspublic SupportedPointFormats.ECPointFormat[] getPointFormatList()
null
or empty if no point formats are included in the list
(the returned array is not cloned or copied by this method)public SupportedPointFormats.ECPointFormat getPointFormat(int id)
id
- the TLS id of the point format to be checkednull
if the point format with the given id is not includedpublic java.lang.Object clone()