Fix STag Filtering
This commit is contained in:
parent
37c3dc44e7
commit
4f548139da
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue