nodejs / nodejs/node

Support GMAC and multiple AAD chunks for AEAD

Abierto
#48,314 5 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

crypto feature request
Lenguaje dominante
JavaScript
Estrellas
122k
Forks
37.3k
Merge medio
4 d 2 h
PR fusionados (30 d)
283

Descripción

What is the problem this feature will solve?

Node.js only allows a single call to setAAD() for AEAD algorithms. AAD that consists of multiple chunks must be concatenated in memory before it can be passed to setAAD(), which is highly inefficient.

GMAC is a MAC algorithm based on AES-GCM that consumes the entire input data as AAD and leaves the plaintext/ciphertext empty. The AES-GCM authentication tag is the MAC produced by GMAC. Implementing GMAC on top of Node.js again requires concatenating all input data in memory before calling setAAD().

What is the feature you are proposing to solve the problem?

Extend the API to allow appending multiple chunks of AAD. This is common practice and supported by various cryptographic libraries, including OpenSSL.

We should consider carefully if such an extension should be a separate WritableStream or if a simpler API makes more sense.

What alternatives have you considered?

Concatenating all data in memory before passing it to setAAD().

My primary use case for multiple calls to setAAD() is GMAC, so a separate GMAC API (similar to the existing HMAC API) would also be sufficient for my purposes. However, it would leave a gap between AES-GCM and GMAC for those rare use cases that have multiple chunks of AAD and a non-empty plaintext/ciphertext.

On a side note, I preliminarily decided against adding streaming support for AAD in https://github.com/wintercg/proposal-webcrypto-streams, see this section of the explainer. However, that is mostly due to the API constraints of the Web Crypto API.

Guía de contribución

Abrir la guía de contribución

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Línea de trabajo

Comience revisando la API crypto de Node.js y el comportamiento existente de setAAD(), y después compare las opciones propuestas con la compatibilidad con OpenSSL mencionada en el issue. El trabajo estará terminado cuando una API acordada admita múltiples fragmentos de AAD y el caso de uso de GMAC sin requerir que los llamadores concatenen toda la entrada en memoria.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
javascript, node.js
Área
api, cryptography
Tipo de issue
Nueva funcionalidad
Dificultad
5/5
Tiempo estimado
Más de una semana
Estado de actividad
Activo
Claridad
Necesita aclaración
Aptitud para principiantes
35/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.