Android 4.2.2 系统签名
来源:互联网 发布:为什么linux没有病毒 编辑:程序博客网 时间:2024/05/30 23:20
这里有原生系统的签名文件platform.pk8和platform.x509.pem以及Signapk工具 。
如果是自己编译的Android系统那么密钥文件在如下位置:
/build/target/product/security/
java -jar signapk.jar platform.x509.pem platform.pk8 input.apk output.apk
这样编译出来的APK就具有的系统签名,无论是装到/system/app中还是/data/app中都会是。
可以通过以下代码检测本应用是否为系统签名的应用:(来自:https://pankajchunchun.wordpress.com/2014/07/08/how-to-check-if-application-is-system-app-or-not-by-signed-signature/)
import android.content.Context;import android.content.pm.ApplicationInfo;import android.content.pm.PackageInfo;import android.content.pm.PackageManager;import android.content.pm.PackageManager.NameNotFoundException;public class AppUtility { private static final String SYSTEM_PACKAGE_NAME = "android"; private PackageManager mPackageManager = null; public AppUtility(Context context) { mPackageManager = (PackageManager) context.getPackageManager(); } /** * Match signature of application to identify that if it is signed by system * or not. * * @param packageName * package of application. Can not be blank. * @return <code>true</code> if application is signed by system certificate, * otherwise <code>false</code> */ public boolean isSystemApp(String packageName) { try { // Get packageinfo for target application PackageInfo targetPkgInfo = mPackageManager.getPackageInfo( packageName, PackageManager.GET_SIGNATURES); // Get packageinfo for system package PackageInfo sys = mPackageManager.getPackageInfo( SYSTEM_PACKAGE_NAME, PackageManager.GET_SIGNATURES); // Match both packageinfo for there signatures return (targetPkgInfo != null && targetPkgInfo.signatures != null && sys.signatures[0] .equals(targetPkgInfo.signatures[0])); } catch (PackageManager.NameNotFoundException e) { return false; } } /** * Check if application is preloaded. It also check if the application is * signed by system certificate or not. * * @param packageName * package name of application. Can not be null. * @return <code>true</code> if package is preloaded and system. */ public boolean isAppPreLoaded(String packageName) { if (packageName == null) { throw new IllegalArgumentException("Package name can not be null"); } try { ApplicationInfo ai = mPackageManager.getApplicationInfo( packageName, 0); // First check if it is preloaded. // If yes then check if it is System app or not. if (ai != null && (ai.flags & (ApplicationInfo.FLAG_SYSTEM | ApplicationInfo.FLAG_UPDATED_SYSTEM_APP)) != 0) { // Check if signature matches if (isSystemApp(packageName) == true) { return true; } else { return false; } } } catch (NameNotFoundException e) { e.printStackTrace(); } return false; }}
0 0
- Android 4.2.2 系统签名
- android 系统签名
- Android 系统签名
- android 系统签名
- android系统release签名
- android系统release签名
- android 系统签名
- Android 应用系统签名
- android apk系统签名
- Android 系统签名
- android系统签名
- android 系统签名
- android 系统签名
- 【签名】4.2.2系统不能安装引出的签名问题
- Android APK 签名系统权限
- Android apk获得系统签名
- android软件获取系统签名
- Android系统权限及签名
- 会计六要素借贷方向
- 获取每小时的天气
- df、du、fdisk:Linux磁盘(或者文件系统)管理
- 进程调度
- Detected both log4j-over-slf4j.jar AND slf4j-log4j12.jar on the class path, preempting StackOverflow
- Android 4.2.2 系统签名
- apache+tomcat集群中jk模式下监控worker的配置
- Oracle存储过程给变量赋值的方法
- 搜狗校园面试题-最近邻居问题Java实现
- spring boot 使用velocity、freeMarker模板创建html页面返回给前端
- 用netcat传输文件
- csv格式的文件上传下载时,逗号列的处理
- 数据库设计
- R语言笔记五