`

no signatures that match those in shared user android.uid.system; ignoring!

阅读更多
转自:http://blog.csdn.net/hmg25/article/details/6447067

最近在做个东西,巧合碰到了sharedUserId的问题,所以收集了一些资料,存存档备份。

    安装在设备中的每一个apk文件,Android给每个APK进程分配一个单独的用户空间,其manifest中的userid就是对应一个Linux用户都会被分配到一个属于自己的统一的Linux用户ID,并且为它创建一个沙箱,以防止影响其他应用程序(或者其他应用程序影响它)。用户ID 在应用程序安装到设备中时被分配,并且在这个设备中保持它的永久性。

通过Shared User id,拥有同一个User id的多个APK可以配置成运行在同一个进程中.所以默认就是可以互相访问任意数据. 也可以配置成运行成不同的进程, 同时可以访问其他APK的数据目录下的数据库和文件.就像访问本程序的数据一样.

对于一个APK来说,如果要使用某个共享UID的话,必须做三步:

1、在Manifest节点中增加android:sharedUserId属性。

2、在Android.mk中增加LOCAL_CERTIFICATE的定义。

如果增加了上面的属性但没有定义与之对应的LOCAL_CERTIFICATE的话,APK是安装不上去的。提示错误是:Package com.test.MyTest has no signatures that match those in shared user android.uid.system; ignoring!也就是说,仅有相同签名和相同sharedUserID标签的两个应用程序签名都会被分配相同的用户ID。例如所有和media/download相关的APK都使用android.media作为sharedUserId的话,那么它们必须有相同的签名media。

3、把APK的源码放到packages/apps/目录下,用mm进行编译。

举例说明一下。

系统中所有使用android.uid.system作为共享UID的APK,都会首先在manifest节点中增加android:sharedUserId="android.uid.system",然后在Android.mk中增加LOCAL_CERTIFICATE := platform。可以参见Settings等

系统中所有使用android.uid.shared作为共享UID的APK,都会在manifest节点中增加android:sharedUserId="android.uid.shared",然后在Android.mk中增加LOCAL_CERTIFICATE := shared。可以参见Launcher等

系统中所有使用android.media作为共享UID的APK,都会在manifest节点中增加android:sharedUserId="android.media",然后在Android.mk中增加LOCAL_CERTIFICATE := media。可以参见Gallery等。

另外,应用创建的任何文件都会被赋予应用的用户标识,并且正常情况下不能被其他包访问。当通过getSharedPreferences(String,int)、openFileOutput(String、int)或者openOrCreate Database(String、int、SQLiteDatabase.CursorFactory)创建一个新文件时,开发者可以同时或分别使用MODE_WORLD_READABLE和MODE_WORLD_RITEABLE标志允许其他包读/写此文件。当设置了这些标志后,这个文件仍然属于自己的应用程序,但是它的全局读/写和读/写权限已经设置,所以其他任何应用程序可以看到它。

关于签名:

build/target/product/security目录中有四组默认签名供Android.mk在编译APK使用:

1、testkey:普通APK,默认情况下使用。

2、platform:该APK完成一些系统的核心功能。经过对系统中存在的文件夹的访问测试,这种方式编译出来的APK所在进程的UID为system。

3、shared:该APK需要和home/contacts进程共享数据。

4、media:该APK是media/download系统中的一环。

应用程序的Android.mk中有一个LOCAL_CERTIFICATE字段,由它指定用哪个key签名,未指定的默认用testkey.





对于使用eclipse编译的apk,可以使用signapk.jar来手动进行签名,其源码在build/tools/signapk下,编译后在out/host/linux-x86/framework/signapk.jar,也可以从网上下载。使用方法,以platform为例:java -jar ./signapk platform.x509.pem platform.pk8 input.apk output.apk  (platform.x509.pem platform.pk8在build/target/product/security获取)
分享到:
评论

相关推荐

    查壳脱壳工具ACKiller 0[1][1].31 pre-release

    ACKiller 0[1][1].31 pre-releaseACKiller 0[1][1].31 pre-releaseACKiller 0[1][1].31 pre-releaseThe file userdb.txt is used to store the external signatures. ;External signatures can be modified by the ...

    apktool documentation

    sharedLibrary - Used to help support Android 5 shared library feature by automatically detecting shared libraries and using --shared-lib on [b]uild Examples of new usage in 2.0 vs 1.5.x Old (Apktool...

    itextsharp signatures 数字签名应用的官方应用代码.rar

    itextsharp 数字签名白皮书配套应用代码 该代码C#示例 详细解释如何通过itext对pdf文件签名和验证操作

    Springer.The.Developer’s.Guide.to.Debugging.2008.pdf

    5.7.1 Check that There are No Major Leaks . . . . . 56 5.7.2 Estimate the Expected Memory Use . . . . . . . 56 5.7.3 Measure Memory Consumption . . . . . . . 57 5.7.4 Find the Data Structures that ...

    dcu2pat,make Delphi .dcu to .pat!!

    So I just add some logic to my .dcu files loader to generate .pat files in right format Supported Delphi versions: Delphi 2007 (v12) Delphi 2009 (v14) Delphi 2010 (v15) Delphi XE (v16) Delphi XE2 ...

    3 D laser sensing at FOI — overview and a system

    in the view ofsystem needs and applications. Our activities include data collection oflaser signatures for target and backgrounds at various wavelengths. We will give examples of such measurements. ...

    WorkFlow Specify

    29. 保密步骤(Private User Steps)...................................................................................9 30. 指定工作暂停(Delayed Assignment) ................................................

    Computer And Intrusion Forensics.7z

    3.2 The role of computer forensics in law enforcement . . . . . . . . 117 vi Contents 3.3 Principles of evidence. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 121 3.3.1 Jurisdictional ...

    http-signatures-test-suite-源码.rar

    http-signatures-test-suite-源码.rar

    EMD.rar_As One_EMD

    The signatures are sets of weighted features that capture the distributions. The features can be of any type and in any number of dimensions, and are defined by the user. The EMD is defined as the ...

    PEiD 0.94查壳工具.rar

    加了多种壳的识别系统! The file userdb.txt is used to store the external signatures. ...A '*' in the results of PEiD signifies that the external database was used for scanning the file.

    Applied Cryptography in .NET and Azure Key Vault 1st Edition

    Benefit from Microsoft's robust suite of security and cryptography primitives to create a complete, hybrid encryption scheme that will protect your data against breaches. This highly practical book ...

    [LNWX17] Lattice-based group signatures_ Achieving full dynamicity with ease.pdf

    [LNWX17] Lattice-based group signatures_ Achieving full dynamicity with ease.pdf

    VclZip pro v3.10.1

    - If a file does not extend beyond any of the original limitations (filesizes of 4 gig or 65535 files) then no Zip64 format information is included in the archive. - property isZip64 - tells you when ...

    asp.net mvc

    To update the custom controller factories to support ASP.NET MVC 2, change the method signature or signatures to match the new signatures, and use the request context parameter instead of the ...

    PEiD0.95.zip

    It can currently detect more than 600 different signatures in PE files. PEiD is special in some aspects when compared to other identifiers already out there! 1. It has a superb GUI and the ...

    esxi-unlocker-302.tgz

    https://github.com/netgc/esxi-unlocker-3.0/releases/tag/3.0.2 https://github.com/SynFUN/ESXiUnlocker/releases/tag/3.0.2

    NIST SP800-89.pdf

    Entities participating in the generation or verification of digital signatures depend on the authenticity of the process. This Recommendation specifies methods for obtaining the assurances necessary ...

    HA.PEiD.0.95

    It can currently detect more than 600 different signatures in PE files. PEiD is special in some aspects when compared to other identifiers already out there! 1. It has a superb GUI and the ...

    ISO15764-2004 Road vehicles extended data link security firstedition

    It is based on cryptographic methods that include encryption, digital signatures and message authentication codes (MACs). It provides a description of services to establish ECUs as trusted parties in...

Global site tag (gtag.js) - Google Analytics