Skip to content

Commit b80ac4e

Browse files
committed
fix: Zero length frames in old version of Node
resolves aws#199 In Node.js versions 10.9 and older will fail to decrypt if decipher.update is not called. nodejs/node#22538 fixes this. If the content is empty, push an empty buffer.
1 parent f642b29 commit b80ac4e

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

modules/decrypt-node/src/decipher_stream.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,10 @@ export function getDecipherStream () {
160160
decipherState = {} as any
161161

162162
decipher.setAuthTag(authTag)
163+
/* In Node.js versions 10.9 and older will fail to decrypt if decipher.update is not called.
164+
* https://github.com/nodejs/node/pull/22538 fixes this.
165+
*/
166+
if (!content.length) decipher.update(Buffer.alloc(0))
163167

164168
const clear: Buffer[] = []
165169
for (const cipherChunk of content) {

0 commit comments

Comments
 (0)