Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
fixup! add extra sanity check
  • Loading branch information
bnoordhuis committed Feb 18, 2020
commit 5d80d47c1bcef3597a26374e7b8a6b8c36f93d7b
11 changes: 11 additions & 0 deletions test/known_issues/test-crypto-authenticated-stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,17 @@ function fstream(config) {
// Observation: 'close' comes before 'end' on |c|, which definitely feels
// wrong. Switching to `c.on('end', ...)` doesn't fix the test though.
crypt.on('close', common.mustCall(() => {
// Just to drive home the point that decryption does actually work:
// reading the file synchronously, then decrypting it, works.
{
const ciphertext = fs.readFileSync(filename('b'));
const d = crypto.createDecipheriv(cipher, key, iv, { authTagLength });
d.setAAD(aad, { plaintextLength });
d.setAuthTag(c.getAuthTag());
const actual = Buffer.concat([d.update(ciphertext), d.final()]);
assert.deepStrictEqual(expected, actual);
}

const d = crypto.createDecipheriv(cipher, key, iv, { authTagLength });
d.setAAD(aad, { plaintextLength });
d.setAuthTag(c.getAuthTag());
Expand Down