Skip to content

Commit 339174f

Browse files
committed
1 parent 3ea5668 commit 339174f

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
## 0.1.3
2+
* Emit an error event from AES-256-GCM Decrypt if the tag length isn't the default 16 bytes / 128 bits.
3+
14
## v0.1.2
25
* Add length attribute for gcm.encrypt to simplify the MAC slicing when appendMac is on
36

lib/aes256gcm.js

+5
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,11 @@ function Decrypt(options) {
4747
return new Decrypt(options);
4848
}
4949
this._decipher = crypto.createDecipheriv('aes-256-gcm', options.key, options.iv);
50+
if (options.mac.length !== 16) {
51+
var message = util.format('Expecting a tag length of 16 bytes / 128 bits rather than %d.', options.mac.length);
52+
var err = new Error(message);
53+
this.emit('error', err);
54+
}
5055
this._decipher.setAuthTag(options.mac);
5156
Transform.call(this, options);
5257
}

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "envelope-encryption-tools",
3-
"version": "0.1.2",
3+
"version": "0.1.3",
44
"main": "lib/main.js",
55
"description": "Lightweight encryption toolkit to support envelope encryption schemes",
66
"license": "MIT",

0 commit comments

Comments
 (0)