Fix bug: crypto.Decipher#update() returns string, not void

This commit is contained in:
John Jeffery
2014-10-05 09:27:32 +10:00
parent 4598e7d76b
commit 0eeb638c89
2 changed files with 15 additions and 1 deletions
+14
View File
@@ -99,6 +99,20 @@ function stream_readable_pipe_test() {
var hmacResult: string = crypto.createHmac('md5', 'hello').update('world').digest('hex');
function crypto_cipher_decipher_string_test() {
var key:Buffer = new Buffer([1, 2, 3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4, 5, 6, 7]);
var clearText:string = "This is the clear text.";
var cipher:crypto.Cipher = crypto.createCipher("aes-128-ecb", key);
var cipherText:string = cipher.update(clearText, "utf8", "hex");
cipherText += cipher.final("hex");
var decipher:crypto.Decipher = crypto.createDecipher("aes-128-ecb", key);
var clearText2:string = decipher.update(cipherText, "hex", "utf8");
clearText2 += decipher.final("utf8");
assert.equal(clearText2, clearText);
}
////////////////////////////////////////////////////
// Make sure .listen() and .close() retuern a Server instance