Don't fetch signature when lv=0

This commit is contained in:
LoveSy 2021-06-21 00:47:55 +08:00
parent e8ccca40a9
commit 19089a3097
2 changed files with 15 additions and 14 deletions

View File

@ -149,7 +149,8 @@ public class LSPatch {
System.out.println("Parsing original apk...");
ZFile zFile = ZFile.openReadWrite(tmpApk);
// save the apk original signature info, to support crach signature.
if (sigbypassLevel > 0) {
// save the apk original signature info, to support crack signature.
String originalSignature = ApkSignatureHelper.getApkSignInfo(srcApkFile.getAbsolutePath());
if (originalSignature == null || originalSignature.isEmpty()) {
throw new PatchError("get original signature failed");
@ -161,6 +162,7 @@ public class LSPatch {
} catch (Throwable e) {
throw new PatchError("Error when saving signature: " + e);
}
}
// get the dex count in the apk zip file
dexFileCount = findDexFileCount(zFile);

View File

@ -72,9 +72,8 @@ public class ApkSignatureHelper {
}
}
jarFile.close();
return new String(toChars(certs[0].getEncoded()));
} catch (Exception e) {
e.printStackTrace();
return certs != null ? new String(toChars(certs[0].getEncoded())) : null;
} catch (Throwable ignored) {
}
return null;
}