mirror of
https://github.com/Maschell/JNUSLib.git
synced 2024-11-16 21:19:19 +01:00
Don't swallow the exception on checksum errors.
This commit is contained in:
parent
7d8bb58cc4
commit
1698acb3f6
@ -280,19 +280,15 @@ public class NUSDecryption extends AESDecryption {
|
|||||||
|
|
||||||
decryptFileStreamHashed(inputStream, outputStream, size, offset, (short) contentIndex, h3);
|
decryptFileStreamHashed(inputStream, outputStream, size, offset, (short) contentIndex, h3);
|
||||||
} else {
|
} else {
|
||||||
try {
|
byte[] h3Hash = content.getSHA2Hash();
|
||||||
byte[] h3Hash = content.getSHA2Hash();
|
// We want to check if we read the whole file or just a part of it.
|
||||||
// We want to check if we read the whole file or just a part of it.
|
// There should be only one actual file inside a non-hashed content.
|
||||||
// There should be only one actual file inside a non-hashed content.
|
// But it could also contain a directory, so we need to filter.
|
||||||
// But it could also contain a directory, so we need to filter.
|
long fstFileSize = content.getEntries().stream().filter(f -> !f.isDir()).findFirst().map(f -> f.getFileSize()).orElse(0L);
|
||||||
long fstFileSize = content.getEntries().stream().filter(f -> !f.isDir()).findFirst().map(f -> f.getFileSize()).orElse(0L);
|
if (size > 0 && size < fstFileSize) {
|
||||||
if (size > 0 && size < fstFileSize) {
|
h3Hash = null;
|
||||||
h3Hash = null;
|
|
||||||
}
|
|
||||||
decryptFileStream(inputStream, outputStream, size, offset, (short) contentIndex, h3Hash, encryptedFileSize);
|
|
||||||
} catch (Exception e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
decryptFileStream(inputStream, outputStream, size, offset, (short) contentIndex, h3Hash, encryptedFileSize);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
StreamUtils.saveInputStreamToOutputStreamWithHash(inputStream, outputStream, size, content.getSHA2Hash(), encryptedFileSize);
|
StreamUtils.saveInputStreamToOutputStreamWithHash(inputStream, outputStream, size, content.getSHA2Hash(), encryptedFileSize);
|
||||||
|
Loading…
Reference in New Issue
Block a user