test: change crypto decipheriv assertion messages
Includes problematic key and iv values into the assertion message PR-URL: https://github.com/nodejs/node/pull/16007 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
This commit is contained in:
parent
30439378b9
commit
2b0145d47c
@ -20,7 +20,8 @@ function testCipher1(key, iv) {
|
|||||||
let txt = decipher.update(ciph, 'hex', 'utf8');
|
let txt = decipher.update(ciph, 'hex', 'utf8');
|
||||||
txt += decipher.final('utf8');
|
txt += decipher.final('utf8');
|
||||||
|
|
||||||
assert.strictEqual(txt, plaintext, 'encryption/decryption with key and iv');
|
assert.strictEqual(txt, plaintext,
|
||||||
|
`encryption/decryption with key ${key} and iv ${iv}`);
|
||||||
|
|
||||||
// streaming cipher interface
|
// streaming cipher interface
|
||||||
// NB: In real life, it's not guaranteed that you can get all of it
|
// NB: In real life, it's not guaranteed that you can get all of it
|
||||||
@ -34,7 +35,8 @@ function testCipher1(key, iv) {
|
|||||||
dStream.end(ciph);
|
dStream.end(ciph);
|
||||||
txt = dStream.read().toString('utf8');
|
txt = dStream.read().toString('utf8');
|
||||||
|
|
||||||
assert.strictEqual(txt, plaintext, 'streaming cipher iv');
|
assert.strictEqual(txt, plaintext,
|
||||||
|
`streaming cipher with key ${key} and iv ${iv}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -52,7 +54,8 @@ function testCipher2(key, iv) {
|
|||||||
let txt = decipher.update(ciph, 'buffer', 'utf8');
|
let txt = decipher.update(ciph, 'buffer', 'utf8');
|
||||||
txt += decipher.final('utf8');
|
txt += decipher.final('utf8');
|
||||||
|
|
||||||
assert.strictEqual(txt, plaintext, 'encryption/decryption with key and iv');
|
assert.strictEqual(txt, plaintext,
|
||||||
|
`encryption/decryption with key ${key} and iv ${iv}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -71,7 +74,8 @@ function testCipher3(key, iv) {
|
|||||||
let deciph = decipher.update(ciph, 'buffer');
|
let deciph = decipher.update(ciph, 'buffer');
|
||||||
deciph = Buffer.concat([deciph, decipher.final()]);
|
deciph = Buffer.concat([deciph, decipher.final()]);
|
||||||
|
|
||||||
assert(deciph.equals(plaintext), 'encryption/decryption with key and iv');
|
assert(deciph.equals(plaintext),
|
||||||
|
`encryption/decryption with key ${key} and iv ${iv}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
testCipher1('0123456789abcd0123456789', '12345678');
|
testCipher1('0123456789abcd0123456789', '12345678');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user