Skip to content

Commit

Permalink
Mitigate nodejs/node#17523.
Browse files Browse the repository at this point in the history
  • Loading branch information
SaltwaterC committed Dec 15, 2017
1 parent 3ea5668 commit 339174f
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
## 0.1.3
* Emit an error event from AES-256-GCM Decrypt if the tag length isn't the default 16 bytes / 128 bits.

## v0.1.2
* Add length attribute for gcm.encrypt to simplify the MAC slicing when appendMac is on

Expand Down
5 changes: 5 additions & 0 deletions lib/aes256gcm.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ function Decrypt(options) {
return new Decrypt(options);
}
this._decipher = crypto.createDecipheriv('aes-256-gcm', options.key, options.iv);
if (options.mac.length !== 16) {
var message = util.format('Expecting a tag length of 16 bytes / 128 bits rather than %d.', options.mac.length);
var err = new Error(message);
this.emit('error', err);
}
this._decipher.setAuthTag(options.mac);
Transform.call(this, options);
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "envelope-encryption-tools",
"version": "0.1.2",
"version": "0.1.3",
"main": "lib/main.js",
"description": "Lightweight encryption toolkit to support envelope encryption schemes",
"license": "MIT",
Expand Down

0 comments on commit 339174f

Please sign in to comment.