Internet-Draft | Compact ECDSA and ECDHE | March 2023 |
Preuß Mattsson | Expires 30 September 2023 | [Page] |
The encodings used in the ECDHE groups secp256r1, secp384r1, and secp521r1 and the ECDSA signature algorithms ecdsa_secp256r1_sha256, ecdsa_secp384r1_sha384, and ecdsa_secp521r1_sha512 have significant overhead and the ECDSA encoding produces variable-length signatures. This document defines new optimal fixed-length encodings and registers new ECDHE groups and ECDSA signature algorithms using these new encodings. The new encodings reduce the size of the ECDHE groups with 33, 49, and 67 bytes and the ECDSA algorithms with an average of 7 bytes. These new encodings also work in DTLS 1.3 and are especially useful in cTLS.¶
This note is to be removed before publishing as an RFC.¶
The latest revision of this draft can be found at https://emanjon.github.io/draft-mattsson-tls-compact-ecc/draft-mattsson-tls-compact-ecc.html. Status information for this document may be found at https://datatracker.ietf.org/doc/draft-mattsson-tls-compact-ecc/.¶
Discussion of this document takes place on the Transport Layer Security Working Group mailing list (mailto:tls@ietf.org), which is archived at https://mailarchive.ietf.org/arch/browse/tls/. Subscribe at https://www.ietf.org/mailman/listinfo/tls/.¶
Source for this draft and an issue tracker can be found at https://github.com/emanjon/draft-mattsson-tls-compact-ecc.¶
This Internet-Draft is submitted in full conformance with the provisions of BCP 78 and BCP 79.¶
Internet-Drafts are working documents of the Internet Engineering Task Force (IETF). Note that other groups may also distribute working documents as Internet-Drafts. The list of current Internet-Drafts is at https://datatracker.ietf.org/drafts/current/.¶
Internet-Drafts are draft documents valid for a maximum of six months and may be updated, replaced, or obsoleted by other documents at any time. It is inappropriate to use Internet-Drafts as reference material or to cite them other than as "work in progress."¶
This Internet-Draft will expire on 30 September 2023.¶
Copyright (c) 2023 IETF Trust and the persons identified as the document authors. All rights reserved.¶
This document is subject to BCP 78 and the IETF Trust's Legal Provisions Relating to IETF Documents (https://trustee.ietf.org/license-info) in effect on the date of publication of this document. Please review these documents carefully, as they describe your rights and restrictions with respect to this document. Code Components extracted from this document must include Revised BSD License text as described in Section 4.e of the Trust Legal Provisions and are provided without warranty as described in the Revised BSD License.¶
The encodings used in the ECDHE groups secp256r1, secp384r1, and secp521r1 and the ECDSA signature algorithms ecdsa_secp256r1_sha256, ecdsa_secp384r1_sha384, and ecdsa_secp521r1_sha512 have significant overhead and the ECDSA encodings produces variable-length signatures. This document defines new optimal fixed-length encodings and registers new ECDHE groups and ECDSA signature algorithms using these new encodings. The new encodings reduce the size of the ECDHE groups with 33, 49, and 67 bytes and the ECDSA algorithms with an average of 7 bytes. These new encodings also work in DTLS 1.3 [RFC9147] and are especially useful in cTLS [I-D.ietf-tls-ctls]. When secp256r1 and ecdsa_secp256r1_sha256 are used as a replacement for the old encodings they reduce the size of a mutually authenticated TLS handshake with on average 80 bytes. The new encodings have the same security properties and requirements as the old encodings.¶
The key words "MUST", "MUST NOT", "REQUIRED", "SHALL", "SHALL NOT", "SHOULD", "SHOULD NOT", "RECOMMENDED", "NOT RECOMMENDED", "MAY", and "OPTIONAL" in this document are to be interpreted as described in BCP 14 [RFC2119] [RFC8174] when, and only when, they appear in all capitals, as shown here.¶
The encoding specified in [RFC8446] of the ECDHE groups secp256r1, secp384r1, and secp521r1 [RFC8422] have significant overhead. This document specifies a new optimal fixed-length encoding for the groups. The new encoding is defined as a compression of the UncompressedPointRepresentation structure. Given a UncompressedPointRepresentation structure [RFC8446]¶
struct { uint8 legacy_form = 4; opaque X[coordinate_length]; opaque Y[coordinate_length]; } UncompressedPointRepresentation;¶
the legacy_form and Y field are omitted to create a CompactRepresentation structure.¶
struct { opaque X[coordinate_length]; } CompactRepresentation;¶
The resulting groups are called secp256r1_compact, secp384r1_compact, and secp521r1_compact. The new encodings have CompactRepresentation structures of length 32, 48, and 66 bytes, and reduce the size with 33, 49, and 67 bytes respectively. For secp256r1_compact, secp384r1_compact, and secp521r1_compact the opaque key_exchange field contains the serialized value of the CompactRepresentation struct.¶
Value | Description | Recommended | Reference |
---|---|---|---|
TBD1 | secp256r1_compact | Y | [This-Document] |
TBD2 | secp384r1_compact | Y | [This-Document] |
TBD3 | secp521r1_compact | Y | [This-Document] |
The difference between compact representation [RFC6090] and point compression [SECG]) is that point compression also communicates the sign bit of the y-coordinate along with the x-coordinate while compact representation only transmits the x-coordinate.¶
The following shows an example compact ECDHE encoding. Figure 1 shows a 65 bytes secp256r1 UncompressedPointRepresentation structure.¶
Figure 2 shows the 32 bytes secp256r1_compact CompactRepresentation structure encoding of the same key share.¶
For compatibility with APIs a compressed y-coordinate might be required. For compatibility with APIs that do not support the full [SECG] format an uncompressed y-coordinate might be required. For point validation an uncompressed y-coordinate is required. Using the notation in [SECG]:¶
For example: The curve P-256 has the parameters (using the notation in [RFC6090])¶
Given an example x:¶
we can calculate y as the square root w = (x3 + a ⋅ x + b)((p + 1)/4) (mod p)¶
Note that this does not guarantee that (x, y) is on the correct elliptic curve. A full validation according to Section 5.6.2.3.3 of [SP-800-56A] is done by also checking that 0 ≤ x < p and that y2 ≡ x3 + a ⋅ x + b (mod p). The implementation MUST perform public-key validation.¶
The variable-length encoding of the ECDSA signature algorithms ecdsa_secp256r1_sha256, ecdsa_secp384r1_sha384, and ecdsa_secp521r1_sha512 specified in [RFC8446] have significant overhead.¶
This document specifies a new optimal fixed-length encoding for the algorithms. The new encoding is defined as a compression of the DER-encoded ECDSA-Sig-Value structure. Given a DER-encoded ECDSA-Sig-Value structure [RFC8422]¶
Ecdsa-Sig-Value ::= SEQUENCE { r INTEGER, s INTEGER }¶
the SEQUENCE type, INTEGER type, and length fields are omitted and if necessary the two INTEGER value fields are truncated (at most a single zero byte) or left padded with zeroes to the fixed length L. For secp256r1, secp384r1, and secp521r1, L is 32, 48, and 66 bytes respectively. The resulting signatures are called ecdsa_secp256r1_sha256_compact, ecdsa_secp384r1_sha384_compact, and ecdsa_secp521r1_sha512_compact and has length 64, 96, and 132 bytes respectively. The new encodings reduce the size of the signatures with an average of 7 bytes. For secp256r1_compact, secp384r1_compact, and secp521r1_compact the opaque signature field contains the compressed Ecdsa-Sig-Value.¶
Value | Description | Recommended | Reference |
---|---|---|---|
TBD4 | ecdsa_secp256r1_sha256_compact | Y | [This-Document] |
TBD5 | ecdsa_secp384r1_sha384_compact | Y | [This-Document] |
TBD6 | ecdsa_secp521r1_sha512_compact | Y | [This-Document] |
The following shows an example compact ECDSA encoding. Figure 3 shows a 71 bytes DER encoded ecdsa_secp256r1_sha256 ECDSA-Sig-Value structure. The values on the left are the ASN.1 tag (in hexadecimal) and the length (in decimal).¶
Figure 4 shows the 64 bytes ecdsa_secp256r1_sha256_compact encoding of the same signature.¶
The new encodings are just encodings and have the same security properties and security requirements as the old encodings. Compact representation of a ECDHE key share produces the same shared secret as the uncompressed encoding and does not change any requirements on point validation, the peers MUST validate each other's public key shares.¶
IANA is requested to update the TLS Supported Groups registry [RFC8447] under the Transport Layer Security (TLS) Parameters heading with the contents of Table 1.¶
IANA is requested to update the TLS SignatureScheme registry [RFC8447] under the Transport Layer Security (TLS) Parameters heading with the contents of Table 2.¶
The authors want to thank Dan Brown, Scott Fluhrer, Erik Thormarker, and Hannes Tschofenig for their valuable comments and feedback.¶