iaik.security.ssl
Class SupportedPointFormats

java.lang.Object
  extended by iaik.security.ssl.Extension
      extended by iaik.security.ssl.SupportedPointFormats
All Implemented Interfaces:
java.lang.Cloneable

public class SupportedPointFormats
extends Extension
implements java.lang.Cloneable

This class implements the 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 critical flag of a server-side ec_point_formats extension to true, the handshake will be aborted if the client does not send an ec_point_formats extension within the extended ClientHello message.

Version:
File Revision 33
See Also:
Extension, ExtensionList

Nested Class Summary
static class SupportedPointFormats.ECPointFormat
          TLS ECC PointFormat.
 
Field Summary
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 Summary
SupportedPointFormats()
          Default Constructor.
SupportedPointFormats(SupportedPointFormats.ECPointFormat[] pointFormats)
          Creates a SupportedPointFormats extension from the given elliptic point format list.
 
Method Summary
 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.
 
Methods inherited from class iaik.security.ssl.Extension
getAllowedProtocolVersions, getExtensionType, getName, getType, setCritical
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

TYPE

public static final ExtensionType TYPE
The type (11) of the ec_point_formats extension.


PF_UNCOMPRESSED

public static final SupportedPointFormats.ECPointFormat PF_UNCOMPRESSED
ECC point format uncompressed (0). Must be supported by any TLS implementation that supports this extension.


PF_COMPRESSED_PRIME

public static final SupportedPointFormats.ECPointFormat PF_COMPRESSED_PRIME
ECC point format ansiX962_compressed_prime (1). Used with prime curves only.


PF_COMPRESSED_CHAR2

public static final SupportedPointFormats.ECPointFormat PF_COMPRESSED_CHAR2
ECC point format ansiX962_compressed_char2 (2). Used with characteristic-2 curves only.

Constructor Detail

SupportedPointFormats

public SupportedPointFormats()
Default Constructor. Creates a new SupportedPointFormats extension indicating support for the default uncompressed point format.
This constructor may be used if you want to use the uncompressed point format only when an ECC based cipher suite is negotiated:
 // 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);
 ...
 


SupportedPointFormats

public SupportedPointFormats(SupportedPointFormats.ECPointFormat[] pointFormats)
Creates a SupportedPointFormats extension from the given elliptic point format list.
This constructor may be used to specify which elliptic point formats are supported. The point formats to be included shall be specified 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);
 ...
 

Parameters:
pointFormats - the list of supported point formats in preference order (the pointFormats array is not cloned or copied by this method)
Throws:
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 providers
Method Detail

getPointFormatList

public SupportedPointFormats.ECPointFormat[] getPointFormatList()
Gets the list of supported point formats included in this SupportedPointFormats extension.

Returns:
the list of supported point formats (in preference order) as array of PointFormat objects; the array maybe null or empty if no point formats are included in the list (the returned array is not cloned or copied by this method)

getPointFormat

public SupportedPointFormats.ECPointFormat getPointFormat(int id)
Checks whether the point format with the given id is included in this SupportedPointFormats extension.

Parameters:
id - the TLS id of the point format to be checked
Returns:
the PointFormat with the given id if it is included, or null if the point format with the given id is not included

clone

public java.lang.Object clone()
Returns a clone of this SupportedPointFormats extension object.

Overrides:
clone in class Extension
Returns:
a clone of this SupportedPointFormats extension object

toString

public java.lang.String toString()
Gets a String representation of this SupportedPointFormats object.

Specified by:
toString in class Extension
Returns:
a String representation of the SupportedPointFormats object

This Javadoc may contain text parts from text parts from IETF Internet Standard specifications (see copyright note).

iSaSiLk 6.0, (c) 2002 IAIK, (c) 2003 - 2015 SIC