ecies-lite
Advanced tools
Comparing version 1.0.5 to 1.0.6
@@ -17,5 +17,5 @@ const crypto = require('crypto'); | ||
exports.config = (curveName, cipherAlgorithm, ivSize) => { | ||
config.curveName = curveName; | ||
config.cipherAlgorithm = cipherAlgorithm; | ||
config.ivSize = ivSize; | ||
config.curveName = curveName || config.curveName; | ||
config.cipherAlgorithm = cipherAlgorithm || config.cipherAlgorithm; | ||
config.ivSize = ivSize || config.ivSize; | ||
}; | ||
@@ -75,3 +75,3 @@ | ||
let mac = crypto.createHmac('sha256', macKey).update(Buffer.concat([epk, iv, ct])).digest(); | ||
if (mac.compare(body.mac) !== 0) | ||
if (mac.compare(body.mac) !== 0 || body.mac.compare(mac) !== 0) | ||
throw new Error('Corrupted Ecies-lite body: unmatched authentication code'); | ||
@@ -78,0 +78,0 @@ let decipher = crypto.createDecipheriv(opts.cipherAlgorithm || config.cipherAlgorithm, encKey, iv); |
{ | ||
"name": "ecies-lite", | ||
"version": "1.0.5", | ||
"version": "1.0.6", | ||
"description": "A lightweight ECIES tool implemented in pure Node.JS", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
6689