补充从 APK 中读签名公钥的细节

This commit is contained in:
juntao
2020-05-11 10:01:22 +08:00
parent 34f452be6e
commit a1548faeda

View File

@ -20,6 +20,7 @@ import com.gh.gamecenter.BuildConfig;
import com.gh.gamecenter.entity.ApkEntity;
import com.gh.gamecenter.entity.GameEntity;
import com.gh.gamecenter.entity.GameUpdateEntity;
import com.gh.gamecenter.manager.PackagesManager;
import com.halo.assistant.HaloApp;
import com.lightgame.download.DownloadEntity;
import com.lightgame.utils.Utils;
@ -201,7 +202,7 @@ public class PackageUtils {
while (entries.hasMoreElements()) {
ZipEntry entry = ((ZipEntry) entries.nextElement());
String entryName = entry.getName();
if (entryName.contains(".RSA")) {
if (entryName.contains("META-INF") && entryName.endsWith(".RSA")) {
InputStream is = apkFile.getInputStream(entry);
CertificateFactory cf = CertificateFactory.getInstance("X.509");
X509Certificate cert = (X509Certificate) cf.generateCertificates(is).toArray()[0];
@ -264,7 +265,7 @@ public class PackageUtils {
if (TextUtils.isEmpty(packageName)) {
return true;
}
boolean isContain = com.gh.gamecenter.manager.PackagesManager.INSTANCE.isInstalled(packageName);
boolean isContain = PackagesManager.isInstalled(packageName);
if (!isContain) {
return true;
}