ANSSI-FR / MLA

Multi Layer Archive - A pure rust encrypted and compressed archive file format
GNU Lesser General Public License v3.0
330 stars 20 forks source link

[Format v2] Consider using HPKE (RFC9180) #211

Open commial opened 4 months ago

commial commented 4 months ago

Context

In order to encrypt for a recipient public key (Public Key Encryption, PKE) using elliptic curve encryption (ECC), MLA uses an ECIES-like scheme. As stated in [^1]:

Elliptic Curve Integrated Encryption Scheme (ECIES) is the best known scheme based on ECC, and as such it has been included in several cryptographic standards.

Some standards based on this scheme are ANSI X9.63 (ECIES), IEEE 1363a, ISO/IEC 18033-2, and SECG SEC 1.

But, to quote ^2:

The key points are that all these existing schemes have shortcomings. They either rely on outdated or not-commonly-used primitives such as RIPEMD and CMAC-AES, lack accommodations for moving to modern primitives (e.g., AEAD algorithms), lack proofs of IND-CCA2 security, or, importantly, fail to provide test vectors and interoperable implementations.

To provide a version which is modern, simple and without the aforementioned shortcoming, HPKE (Hybrid PKE) has been proposed as of RFC9180^3. This scheme is used in TLS and implemented in other cryptographic library such as OpenSSL or WolfSSL.

Proposed integration to MLA

Several aspects can be considered:

Shared secret derivation in ECC

The public key derivation for the ECC could be based on this RFC. In particular:

Integration with the AEAD scheme

MLA targets several recipient, so HPKE can't be applied directly. Instead, a two layer encryption could be use (a bit like ^multi):

  1. for each recipient, obtain a shared secret
  2. use this shared secret to decrypt the common archive key

HPKE specification introduces reusability: the secret produced can be either used with asecret export (section 5.3) or a Key schedule (5.2).

As a result, we can either:

Hybrid PQC encryption

The format v2 targets the use of Hybrid PQC encryption (#195).

Extension to the ML-KEM (such as ^4, with the difference that we target FIPS-203 1024 instead of 768, or ^5 defining ML-KEM-1024 as algorithm 0x0080) can be considered. To the author knowledge, there is no standard for now for hybrid PQC in HPKE, but it is likely that one might emerge.

Expected benefits

[^1]: A comparison of the standardized versions of ECIES, 2010