jose-node-esm-runtime
Advanced tools
Comparing version 4.9.1 to 4.9.2
@@ -98,6 +98,6 @@ import { decode as base64url } from '../../runtime/base64url.js'; | ||
try { | ||
cek = await decryptKeyManagement(alg, key, encryptedKey, joseHeader); | ||
cek = await decryptKeyManagement(alg, key, encryptedKey, joseHeader, options); | ||
} | ||
catch (err) { | ||
if (err instanceof TypeError) { | ||
if (err instanceof TypeError || err instanceof JWEInvalid || err instanceof JOSENotSupported) { | ||
throw err; | ||
@@ -104,0 +104,0 @@ } |
@@ -12,3 +12,3 @@ import { unwrap as aesKw } from '../runtime/aeskw.js'; | ||
import { unwrap as aesGcmKw } from './aesgcmkw.js'; | ||
async function decryptKeyManagement(alg, key, encryptedKey, joseHeader) { | ||
async function decryptKeyManagement(alg, key, encryptedKey, joseHeader, options) { | ||
checkKeyType(alg, key, 'decrypt'); | ||
@@ -67,2 +67,5 @@ switch (alg) { | ||
throw new JWEInvalid(`JOSE Header "p2c" (PBES2 Count) missing or invalid`); | ||
const p2cLimit = (options === null || options === void 0 ? void 0 : options.maxPBES2Count) || 10000; | ||
if (joseHeader.p2c > p2cLimit) | ||
throw new JWEInvalid(`JOSE Header "p2c" (PBES2 Count) out is of acceptable bounds`); | ||
if (typeof joseHeader.p2s !== 'string') | ||
@@ -69,0 +72,0 @@ throw new JWEInvalid(`JOSE Header "p2s" (PBES2 Salt) missing or invalid`); |
@@ -404,2 +404,9 @@ /** | ||
inflateRaw?: InflateFunction | ||
/** | ||
* (PBES2 Key Management Algorithms only) Maximum allowed "p2c" (PBES2 Count) Header Parameter | ||
* value. The PBKDF2 iteration count defines the algorithm's computational expense. By default | ||
* this value is set to 10000. | ||
*/ | ||
maxPBES2Count?: number | ||
} | ||
@@ -406,0 +413,0 @@ |
{ | ||
"name": "jose-node-esm-runtime", | ||
"version": "4.9.1", | ||
"version": "4.9.2", | ||
"homepage": "https://github.com/panva/jose", | ||
@@ -5,0 +5,0 @@ "repository": "panva/jose", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
232237
5926