Cod*_*uru 3 android code-signing android-source
我需要修改文件/data/app夹中现有的 .apk 文件。修改后,Meta-INF文件夹中的签名会发生变化。因此,为了确保 apk 正常工作,我需要使用正确的 md5sum 将它们辞职。
是否可以通过java以编程方式退出apks,仅通过代码生成私钥和证书?
我正在使用 Bouncy Castle 和这个类。重新签名示例:
SignedJar bcApk = new SignedJar(
new FileOutputStream("out.apk"), signChain, signCert, signKey);
JarFile jsApk = new JarFile(new File("in.apk"));
Enumeration<JarEntry> entries = jsApk.entries();
while (entries.hasMoreElements()) {
JarEntry entry = entries.nextElement();
String name = entry.getName();
if (!entry.isDirectory() && !name.startsWith("META-INF/")) {
InputStream eis = jsApk.getInputStream(entry);
bcApk.addFileContents(name, IOUtils.toByteArray(eis));
eis.close();
}
}
jsApk.close();
bcApk.close();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1732 次 |
| 最近记录: |