Skip to content

Commit

Permalink
crypto: ensure "x" is present when importing private CFRG webcrypto keys
Browse files Browse the repository at this point in the history
PR-URL: nodejs#45569
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Backport-PR-URL: nodejs#47336
  • Loading branch information
panva committed Mar 31, 2023
1 parent ae600b9 commit 252839a
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/internal/crypto/cfrg.js
Expand Up @@ -276,6 +276,10 @@ async function cfrgImportKey(
}
}

if (!isPublic && typeof keyData.x !== 'string') {
throw lazyDOMException('Invalid JWK keyData', 'DataError');
}

verifyAcceptableCfrgKeyUse(
name,
isPublic ? 'public' : 'private',
Expand Down

0 comments on commit 252839a

Please sign in to comment.