Skip to content

Commit c50dfa1

Browse files
authored
fix: Zero length frames in old version of Node (#202)
resolves #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 12d1661 commit c50dfa1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

modules/decrypt-node/src/decipher_stream.ts

+4
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)