browserify-aes
Advanced tools
Comparing version 0.7.1 to 0.7.2
@@ -24,5 +24,6 @@ var Transform = require('stream').Transform; | ||
CipherBase.prototype._flush = function (next) { | ||
var chunk = this._final(); | ||
if (chunk) { | ||
this.push(chunk); | ||
try { | ||
this.push(this._final()); | ||
} catch(e) { | ||
return next(e); | ||
} | ||
@@ -29,0 +30,0 @@ next(); |
{ | ||
"name": "browserify-aes", | ||
"version": "0.7.1", | ||
"version": "0.7.2", | ||
"description": "aes, for browserify", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -441,2 +441,24 @@ var test = require('tape'); | ||
} | ||
function incorectPaddingDoesNotThrow(padding) { | ||
test('stream incorrect padding ' + padding.toString('hex'), function (t) { | ||
t.plan(2); | ||
var block1 = new Buffer(16); | ||
block1.fill(4); | ||
var cipher = crypto.createCipher('aes128', new Buffer('password')); | ||
cipher.setAutoPadding(false); | ||
var decipher = crypto.createDecipher('aes128', new Buffer('password')); | ||
var decipher2 = _crypto.createDecipher('aes128', new Buffer('password')); | ||
cipher.pipe(decipher); | ||
cipher.pipe(decipher2); | ||
cipher.write(block1); | ||
cipher.write(padding); | ||
decipher.on('error', function (e) { | ||
t.ok(e, 'mine'); | ||
}); | ||
decipher2.on('error', function (e) { | ||
t.ok(e, 'node'); | ||
}); | ||
cipher.end(); | ||
}); | ||
} | ||
var sixteens2 = new Buffer(16); | ||
@@ -446,2 +468,3 @@ sixteens2.fill(16); | ||
incorectPaddingthrows(sixteens2); | ||
incorectPaddingDoesNotThrow(sixteens2); | ||
var fifteens2 = new Buffer(16); | ||
@@ -452,3 +475,3 @@ fifteens2.fill(15); | ||
incorectPaddingthrows(fifteens2); | ||
incorectPaddingDoesNotThrow(fifteens2); | ||
var two = _crypto.randomBytes(16); | ||
@@ -458,2 +481,3 @@ two[15] = 2; | ||
incorectPaddingthrows(two); | ||
incorectPaddingDoesNotThrow(two); | ||
test('autopadding false decipher', function (t) { | ||
@@ -460,0 +484,0 @@ t.plan(2); |
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
417962
3328