Skip to content

crypto: support non-byte WebCrypto lengths and cSHAKE#63988

Open
panva wants to merge 1 commit into
nodejs:mainfrom
panva:webcrypto-non-byte-lengths
Open

crypto: support non-byte WebCrypto lengths and cSHAKE#63988
panva wants to merge 1 commit into
nodejs:mainfrom
panva:webcrypto-non-byte-lengths

Conversation

@panva

@panva panva commented Jun 18, 2026

Copy link
Copy Markdown
Member

Add shared bit-length helpers for WebCrypto operations that accept bit sequences whose length is not byte-aligned.

Use the helpers for cSHAKE output, ECDH-derived bits, HMAC/KMAC key generation/import/derivation, and KMAC sign/verify output. Preserve the requested bit length in CryptoKey algorithm metadata while storing and exporting rounded-up byte material with unused low bits cleared.

Keep byte-multiple validation for algorithms whose specs require it.

Extend the lower-end of KMAC's key length support.

Enable cSHAKE customization and functionName parameters.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/crypto

@nodejs-github-bot nodejs-github-bot added lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. labels Jun 18, 2026
@panva panva added crypto Issues and PRs related to the crypto subsystem. webcrypto labels Jun 18, 2026
@panva panva force-pushed the webcrypto-non-byte-lengths branch 3 times, most recently from f27f79a to b9e0073 Compare June 18, 2026 20:25
@panva panva marked this pull request as draft June 18, 2026 22:02
@panva panva changed the title crypto: support non-byte WebCrypto lengths crypto: support non-byte WebCrypto lengths and cSHAKE Jun 18, 2026
@panva panva force-pushed the webcrypto-non-byte-lengths branch from b9e0073 to ffa0349 Compare June 18, 2026 22:05
@panva panva marked this pull request as ready for review June 18, 2026 22:07
Comment thread lib/internal/crypto/util.js Outdated
@nodejs-github-bot

This comment was marked as outdated.

Add shared bit-length helpers for WebCrypto operations that accept bit
sequences whose length is not byte-aligned.

Use the helpers for cSHAKE output, ECDH-derived bits, HMAC/KMAC key
generation/import/derivation, and KMAC sign/verify output. Preserve the
requested bit length in CryptoKey algorithm metadata while storing and
exporting rounded-up byte material with unused low bits cleared.

Keep byte-multiple validation for algorithms whose specs require it.

Extend the lower-end of KMAC's key length support.

Enable cSHAKE customization and functionName parameters.

Signed-off-by: Filip Skokan <panva.ip@gmail.com>
@panva panva force-pushed the webcrypto-non-byte-lengths branch from 86c6e6d to ee1069c Compare June 19, 2026 09:00
@panva panva added the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Jun 19, 2026
@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

This comment was marked as outdated.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. crypto Issues and PRs related to the crypto subsystem. lib / src Issues and PRs related to general changes in the lib or src directory. needs-ci PRs that need a full CI run. webcrypto

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants