Fix STag Filtering

This commit is contained in:
xhacker-zzz 2023-01-18 02:13:53 +08:00
parent 37c3dc44e7
commit 4f548139da
2 changed files with 7 additions and 5 deletions

View File

@ -131,6 +131,10 @@ public:
int PreDecode(std::string ext) {
cipherType = checkType(ext);
size_t tailSize = 0;
if (cipherType == "invalid" || cipherType == "STag") {
error = "file is invalid or not supported (Please downgrade your app).";
return -1;
}
if (cipherType == "QTag") {
tailSize = 8;
}
@ -156,10 +160,6 @@ public:
}
rawKeyBuf = tmp;
}
if (cipherType == "invalid") {
error = "file is invalid or not supported(Please downgrade your app.)";
return -1;
}
return keySize + tailSize;
}

View File

@ -130,7 +130,9 @@ export class QmcDecoder {
private searchKey() {
const last4Byte = this.file.slice(-4);
const textEnc = new TextDecoder();
if (textEnc.decode(last4Byte) === 'QTag') {
if (textEnc.decode(last4Byte) === 'STag') {
throw new Error('文件中没有写入密钥无法解锁请降级App并重试');
} else if (textEnc.decode(last4Byte) === 'QTag') {
const sizeBuf = this.file.slice(-8, -4);
const sizeView = new DataView(sizeBuf.buffer, sizeBuf.byteOffset);
const keySize = sizeView.getUint32(0, false);