🐛 Fix compressed size calculation, do not change original decryption keys
This commit is contained in:
parent
5ca48459c1
commit
3e9f4843f8
1 changed files with 4 additions and 3 deletions
|
@ -31,13 +31,14 @@ export default function extractFileStream(file: ISsnFileEntry, inputStream: stre
|
||||||
|
|
||||||
let curStream = inputStream;
|
let curStream = inputStream;
|
||||||
|
|
||||||
//set max length
|
const storedSize = (file.decryptionKeys !== undefined) ? (12 + file.compressedSize) : file.compressedSize;
|
||||||
const maxLength = streamSetMaxLength(curStream, 12 + file.compressedSize);
|
//set max length (including random 12 byte encryption header)
|
||||||
|
const maxLength = streamSetMaxLength(curStream, storedSize);
|
||||||
curStream = maxLength;
|
curStream = maxLength;
|
||||||
|
|
||||||
//pipe into decryption if file is encrypted
|
//pipe into decryption if file is encrypted
|
||||||
if (file.decryptionKeys !== undefined) {
|
if (file.decryptionKeys !== undefined) {
|
||||||
const decryptTransform = decryptStream(curStream, file.decryptionKeys);
|
const decryptTransform = decryptStream(curStream, [...file.decryptionKeys] as [number, number, number]);
|
||||||
curStream = decryptTransform;
|
curStream = decryptTransform;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue