jose-node-cjs-runtime
Advanced tools
Comparing version 3.11.3 to 3.11.4
@@ -23,17 +23,20 @@ "use strict"; | ||
} | ||
let plaintext; | ||
const expectedTag = cbc_tag_js_1.default(aad, iv, ciphertext, macSize, macKey, keySize); | ||
let macCheckPassed; | ||
try { | ||
const cipher = crypto_1.createDecipheriv(algorithm, encKey, iv); | ||
plaintext = buffer_utils_js_1.concat(cipher.update(ciphertext), cipher.final()); | ||
macCheckPassed = timing_safe_equal_js_1.default(tag, expectedTag); | ||
} | ||
catch { | ||
} | ||
const expectedTag = cbc_tag_js_1.default(aad, iv, ciphertext, macSize, macKey, keySize); | ||
let macCheckPassed; | ||
if (!macCheckPassed) { | ||
throw new errors_js_1.JWEDecryptionFailed(); | ||
} | ||
let plaintext; | ||
try { | ||
macCheckPassed = timing_safe_equal_js_1.default(tag, expectedTag); | ||
const cipher = crypto_1.createDecipheriv(algorithm, encKey, iv); | ||
plaintext = buffer_utils_js_1.concat(cipher.update(ciphertext), cipher.final()); | ||
} | ||
catch { | ||
} | ||
if (!plaintext || !macCheckPassed) { | ||
if (!plaintext) { | ||
throw new errors_js_1.JWEDecryptionFailed(); | ||
@@ -40,0 +43,0 @@ } |
@@ -46,3 +46,3 @@ "use strict"; | ||
case 'RS512': | ||
if (key.algorithm.name.toUpperCase() !== 'RSASSA-PKCS1-V1_5' || | ||
if (key.algorithm.name !== 'RSASSA-PKCS1-v1_5' || | ||
getHashLength(key.algorithm.hash) !== parseInt(alg.substr(2), 10)) { | ||
@@ -49,0 +49,0 @@ throw new TypeError('CryptoKey does not support this operation'); |
{ | ||
"name": "jose-node-cjs-runtime", | ||
"version": "3.11.3", | ||
"version": "3.11.4", | ||
"description": "(Node.JS CJS Runtime) 'JSON Web Almost Everything' - JWA, JWS, JWE, JWT, JWK with no dependencies", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
159527
3911