`
DavisWang
  • 浏览: 52422 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

如何解决“These packages should not be signed with a well known key”问题

 
阅读更多
    如果你在做CTS测试时出现此问题:
junit.framework.AssertionFailedError: These packages should not be signed with a well known key: [xxx.xxx.xxx.xxx] at android.security.cts.PackageSignatureTest.testPackageSignatures(PackageSignatureTest.java:62)

会令你感到莫名其妙。这个问题一般是由于使用android提供的缺省私钥对apk包进行签名,导致CTS测试失败。

    很多开发者不使用自己的key签名而是使用android提供的缺省私钥对apk包进行签名。只要打开apk包下的META-INF\CERT.RSA查看其中是否有android@android.com或者通过命令jarsigner -verify -certs -verbose xxx.apk查看就知道是否是使用了缺省私钥对包进行了签名。注:jarsigner是JDK命令。
    相关的CTS junit的源码如下

security/src/anroid/security/cts/PackageSignatureTest.java

        for (PackageInfo packageInfo : allPackageInfos) {
                String packageName = packageInfo.packageName;
                if (packageName != null && ! isWhitelistedPackage(packageName)) {
                        for (Signature signature : packageInfo.signatures) {

             // android的缺省签名是wellKnownSignatures所有一旦你的包使用它签名一定会被列为badPackages
             if (wellKnownSignatures.contains(signature)) {
                 badPackages.add(packageInfo.packageName);

             }
                        }
                }
        }

        assertTrue("These packages should not be signed with a well known key: " + badPackages,  badPackages.isEmpty());

分享到:
评论

相关推荐

    wellknown:WKT <-> GeoJSON

    install.packages( " wellknown " ) 开发版本 pak :: pkg_install( " ropensci/wellknown " ) # OR install.packages( " wellknown " , repos = " https://dev.ropensci.org " ) library( " wellknown " ) 元 请。...

    pip matplotlib报错equired packages can not be built解决

    * The following required packages can not be built: * freetype, png error: Setup script exited with 1 这是因为pip不能安装操作系统的依赖库导致的,需要用yum手动安装: $ yum -y install freetype-devel ...

    a project model for the FreeBSD Project.7z

    with due respect to the original software tools ideology as well as usability, performance and stability.” The architectural guidelines help determine whether a problem that someone wants to be ...

    Pro REST API Development with Node.js(Apress,2015)

    This book will provide a brief background on REST and the tools it provides (well known and not so well known). Understand how there is more to REST than just JSON and URLs. You will then cover and ...

    Data Mining with R: Learning with Case Studies, Second Edition

    Designed for users of data analysis tools, as well as researchers and developers, the book should be useful for anyone interested in entering the "world" of R and data mining. About the Author Luís...

    anaconda安装pytorch时报错PackagesNotFoundError: The following packages are not available from current cha

    PackagesNotFoundError: The following packages are not available from current channels: 原因是因为我将安装源设置为清华镜像,而在2019年4月份anaconda的清华镜像不能用了:    所以我们需要手动下载whl文件...

    rubygems-update-3.1.3.gem

    A package (also known as a library) contains a set of functionality that can be invoked by a Ruby program, such as reading and parsing an XML file. We call these packages 'gems' and RubyGems is a tool...

    BURNINTEST--硬件检测工具

    - Added a hot Key, F4, to set the auto run flag and run the tests (i.e. set "-r" and then run the tests). - Other minor changes. Release 5.3 build 1018 WIN32 release 16 April 2008 - Added an ...

    CRC.Data.Mining.with.R.Learning.with.Case.Studies.2nd.Edition

    Designed for users of data analysis tools, as well as researchers and developers, the book should be useful for anyone interested in entering the "world" of R and data mining. Table of Contents ...

    表格控件Vcl TopGrid.v3.01

    Please note that with TopGrid 3.01, the TtsDbGrid component is no longer supported and should NOT be used with this version. The new component TosAdvDbGrid replaces this component and has a easy to ...

    R.Packages.1491910593

    Learn from a well-respected member of the R community who created 30 R packages, including ggplot2, dplyr, and tidyr Table of Contents Part I. Getting Started Chapter 1. Introduction Chapter 2. ...

    WizFlow网页编辑

    When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ...

    hibernate-shards.jar

    When a program is linked with a library, whether statically or using a shared library, the combination of the two is legally speaking a combined work, a derivative of the original library. The ...

    ICS delphixe10源码版

    ICS V7 is a stable release that may still be updated for major bugs, but not for new releases of Delphi, latest it supported was XE3. ICS V8 is the current development release which is held in a ...

    redis商用版本,redis解决每秒超限问题

    Redis驱动ServiceStack.Redis 4.0以后开始商用,所以在各个地方做了限制: 这里项目里也遇到6000次限制问题,最后想...The NuGet packages above include the quota's below which can be unlocked with a license key

    mingw-w64-gcc-9.3-stable-r32

    MinGW-w64 builds of GCC/Binutils for Windows These packages contain both 32-bit and 64-bit compilers/binutils, ...This toolchain should be complemented with a MSYS environment for a full build-system.

    LCTF软件备份VariSpec™ Liquid Crystal Tunable Filters

    When the explicitly set palette state overwrites a palette state implicitly associated with a certain wavelength, that wavelength will not be accurately set when one issues the VsSetWavelength() ...

Global site tag (gtag.js) - Google Analytics