From 1698acb3f6afcb87ef64f9d42a3f5749cdb7f936 Mon Sep 17 00:00:00 2001 From: Maschell Date: Sun, 14 Apr 2019 14:49:47 +0200 Subject: [PATCH] Don't swallow the exception on checksum errors. --- .../utils/cryptography/NUSDecryption.java | 20 ++++++++----------- 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/src/de/mas/wiiu/jnus/utils/cryptography/NUSDecryption.java b/src/de/mas/wiiu/jnus/utils/cryptography/NUSDecryption.java index d7f7703..0883d0c 100644 --- a/src/de/mas/wiiu/jnus/utils/cryptography/NUSDecryption.java +++ b/src/de/mas/wiiu/jnus/utils/cryptography/NUSDecryption.java @@ -280,19 +280,15 @@ public class NUSDecryption extends AESDecryption { decryptFileStreamHashed(inputStream, outputStream, size, offset, (short) contentIndex, h3); } else { - try { - byte[] h3Hash = content.getSHA2Hash(); - // 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. - // 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); - if (size > 0 && size < fstFileSize) { - h3Hash = null; - } - decryptFileStream(inputStream, outputStream, size, offset, (short) contentIndex, h3Hash, encryptedFileSize); - } catch (Exception e) { - e.printStackTrace(); + byte[] h3Hash = content.getSHA2Hash(); + // 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. + // 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); + if (size > 0 && size < fstFileSize) { + h3Hash = null; } + decryptFileStream(inputStream, outputStream, size, offset, (short) contentIndex, h3Hash, encryptedFileSize); } } else { StreamUtils.saveInputStreamToOutputStreamWithHash(inputStream, outputStream, size, content.getSHA2Hash(), encryptedFileSize);