Skip to content

Commit

Permalink
small fix to HP888PackerTransformer and show full exception on catch
Browse files Browse the repository at this point in the history
EpicPlayerA10 committed Oct 15, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
1 parent 4953c01 commit 280f044
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -53,17 +53,18 @@ protected void transform() throws Exception {
cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(Base64.getDecoder().decode(key.get()), "AES"));
context().getFiles().forEach((file, bytes) -> {
if (file.endsWith(encryptedClassFilesSuffix)) {
String cleanFileName = file.replace(encryptedClassFilesSuffix, "").replace(".", "/");
filesToRemove.add(file);

String className = file.replace(encryptedClassFilesSuffix, "").replace(".", "/");
try {
// Decrypt!
byte[] decrypted = cipher.doFinal(bytes);

// Load class
newClasses.put(cleanFileName, ClassHelper.loadUnknownClass(cleanFileName, decrypted, ClassReader.SKIP_FRAMES));
newClasses.put(className, ClassHelper.loadUnknownClass(className + ".class", decrypted, ClassReader.SKIP_FRAMES));
markChange();
} catch (Exception e) {
LOGGER.error(e);
throw new RuntimeException("Failed to decrypt class: " + className, e);
}
}
});

0 comments on commit 280f044

Please sign in to comment.