在最新的Android SDK中我们看到了Android签名证书机制的出现,也就是说几乎和Symbian OS v9.x以上平台构架一样,都需要数字签名证书才可以运行,这也是考虑到平台的安全性,同样也提供了类似的自签名self-signed证书。

  Android系统要求所有安装的应用程序必需有数字签名。否这系统将不会安装后运行程序在没有合适的签名许可。最终无论是在真是设备还是模拟器上都必须给你的程序建立签名才可以调试运行。(The Android system requires that all installed applications are digitally signed — the system will not install or run an application that is not signed appropriately. This applies wherever the Android system is run, whether on an actual device or on the emulator. For this reason, you must set up signing for your application before you will be able to run or debug it on an emulator or device.)

  重点理解有关Android程序签名:(The important points to understand about signing Android applications are)

  所有程序必需签名,系统将不会安装一个未签名的程序。All applications must be signed. The system will not install an application that is not signed

  你可以自签名self-signed证书给你的程序.没有证书验证也是需要的。You can use self-signed certificates to sign your applications. No certificate authority is needed

  系统测试一个签名证书过期日期仅仅在安装时,如果程序签名已经过了在安装后,那么程序将可以继续使用正常的功能。The system tests a signer certificate's expiration date only at install time. If an application's signer certificate expires after the application is installed, the application will continue to function normally

你可以使用标准工具KeyTool和Jarsigner来生成密钥和签名你的程序在apk文件中。

  The Android SDK tools assist you in signing your applications when debugging. Both the ADT Plugin for Eclipse and the Ant build tool offer two signing modes — debug mode and release mode.

  In debug mode, the build tools use the Keytool utility, included in the JDK, to create a keystore and key with a known alias and password. At each compilation, the tools then use the debug key to sign the application .apk file. Because the password is known, the tools don't need to prompt you for the keystore/key password each time you compile.

  When your application is ready for release, you compile it in release signing mode. In release mode, the tools compile your .apk without signiing it. You must then use Keytool to generate your own keystore/key and then use the Jarsigner tool, also included in the JDK, to sign the .apk.

  Basic Setup for Signing

  To support the generation of a keystore and debug key, you should first make sure that Keytool is available to the SDK build tools. In most cases, you can tell the SDK build tools how to find Keytool by making sure that your JAVA_HOME environment variable is set and that it references a suitable JDK. Alternatively, you can add the JDK version of Keytool to your PATH variable.

  If you are developing on a version of Linux that originally came with Gnu Compiler for Java, make sure that the system is using the JDK version of Keytool, rather than the gcj version. If Keytool is already in your PATH, it might be pointing to a symlink at /usr/bin/keytool. In this case, check the symlink target to make sure that it points to the Keytool in the JDK.

  Signing in Eclipse/ADT

  If you are developing in Eclipse and have set up Keytool as described above, signing in debug mode is enabled by default. When you run or debug your app, ADT signs the .apk for you and installs it on the emulator. No specific action on your part is needed, provided ADT has access to Keytool.

  To compile your application in release mode, right-click the project in the Package pane and select Android Tools > Export Application Package. Alternatively, you can follow the "Exporting the unsigned .apk" link in the Manifest Editor overview page. After you have saved the exported .apk, you need to use Jarsigner to sign the .apk with your own key before distribution. If you don't have a key, you can use Keystore to create a keystore and key with all the appropriate fields. If you already have a key, such as a corporate key, you can use that to sign the .apk.

  Signing in Ant

  If you use Ant to build your .apk files, debug signing mode is enabled by default, assuming that you are using a build.xml file generated by the activitycreator tool included in the latest SDK. When you run Ant against build.xml to compile your app, the build script generates a keystore/key and signs the .apk for you. No specific action on your part is needed.

  To compile your application in release mode, all you need to do is specify a build target "release" in the Ant command. For example, if you are running Ant from the directory containing your build.xml file, the command would look like this:

ant release

  The build script compiles the application .apk without signing it. After you have compiled the.apk, you need to use Jarsigner to sign the .apk with your own key before distribution. If you don't have a key, you can use Keystore to create a keystore and key with all the appropriate fields. If you already have a key, such as a corporate key, you can use that to sign the .apk.

  Expiry of the Debug Certificate

  The self-signed certificate used to sign your application in debug mode (the default on Eclipse/ADT and Ant builds) will have an expiration date of 1 year from its creation date.

  When the certificate expires, you will get a build error. On Ant builds, the error looks like this:

debug:
[echo] Packaging bin/samples-debug.apk, and signing it with a debug key...
[exec] Debug Certificate expired on 8/4/08 3:43 PM

  In Eclipse/ADT, you will see a similar error in the Android console.

  To fix this problem, simply delete the debug.keystore file. On Linux/Mac OSX, the file is stored in ~/.android. On Windows, the file is stored in C:Documents and SettingsLocal SettingsApplication DataAndroid.

  The next time you build, the build tools will regenerate a new keystore and debug key.

Android签名证书相关推荐

  1. Android 签名证书生成及jks与keystore 相互转换

    Android 签名证书生成及jks与keystore 相互转换 keytool 这个工具是JDK里面自带的,配置好JDK环境可直接在命令行完成一下操作! 生成签名证书: 生成JKS证书: keyto ...

  2. Android签名证书 keystore jks pem x509

    Android签名证书 背景 因业务需求,经常与系统厂商打交道,大多需要厂商开放root权限 目前获取系统权限的总结有三种方式(均有实际应用) platform签名 root固件 (有su) 调用厂商 ...

  3. Android签名证书的生成

    本节只针对如何从零开始实现简单的打包签名 目录 概要 Keytool生成JKS签名证书 Android Studio生成JKS签名证书 AS版本信息 签名证书的生成 签名打包 概要 debug.key ...

  4. 安卓APP证书Android签名证书.keystore文件制作生成

    将app发布到应用宝时,而上传安装包时提示如下图时, 但您或您的团队从未上传该应用,您可以通过认领功能认领应用.认领成功后该应用会自动转入您的账户下,同时保留应用全部数据,您可以在应用管理中进行管理. ...

  5. 百度地图2.1获取密钥配置的Android签名证书的sha1值

    进入cmd后定位到.android文件夹下(cd .android),然后 输入 keytool -list -v -keystore debug.keystore 这样就把三种指纹证书全部列出来了, ...

  6. android签名忘记密码,修改Android签名证书keystore的密码、别名alias以及别名密码

    之前在测试Eclipse ADT的Custom debug Eclipse ADT的Custom debug keystore所需证书规格,提到过自定义调试证书的密码和 1. 首先当然是先复制一份正式 ...

  7. 我的Android进阶之旅------修改Android签名证书keystore的密码、别名alias以及别名密码...

    转载于:http://blog.k-res.net/archives/1229.html  和 http://blog.k-res.net/archives/1671.html ADT允许自定义调试用 ...

  8. 获取android应用签名证书(打包APK用到的那个文件)的SHA1,MD5,SHA256值

    转载自:http://www.cnblogs.com/goldeneast/archive/2013/09/09/3309129.html http://developer.baidu.com/map ...

  9. android自验签名证书,没有以前的互联网连接,无法验证Android自签名证书

    使用SSL基础架构: 我们有一个有效的客户端/服务器设置,其中Android版本4.2和4.4的手机充当客户端,必须通过其自签名SSL证书验证服务器. 问题: 只要设备在尝试连接之前至少有一次互联网访 ...

最新文章

  1. 安卓开发 登录用户信息缓存_小程序云开发之用户注册登录
  2. 如何在Spring中将@RequestParam绑定到对象
  3. 监控oracle数据io,Prometheus监控Oracle数据库
  4. C#中使用NPIO实现导入导出Excel简单操作
  5. 数学建模及其算法概述
  6. 带有审图号的区位图制作
  7. Python+django网页设计入门(16):优化设计复用分页代码
  8. Cocos2d之Ref类与内存管理使用详解
  9. linux ftp常用操作,linux 操作 ftp 常用命令
  10. Redis学习笔记~Redis并发锁机制
  11. 模型选择 + 过拟合和欠拟合 动手学深度学习v2 pytorch
  12. chinapub matlab,MATLAB与通信仿真
  13. EasyPay移动支付框架
  14. Directx游戏中嵌入IE浏览器实现过程
  15. VTK:图像阈值用法实战
  16. 2011年戴尔服务器型号,PowerEdge 11G R310机架式服务器
  17. java地铁售票机系统_Java_地铁购票系统
  18. 网络安全设备常见弱口令
  19. vs 2010 sp1 中文版 安装sliverlight 5 正式版
  20. chipseq MACS2 call peaks 报错解决方法——创建虚拟环境

热门文章

  1. 关于负载均衡一些概念的正确理解
  2. 技术人的危机-非理性的繁荣
  3. python学习day1:初识python
  4. mycat1.4.1小白用户入门(一)
  5. RHEL7.0 防火墙入门
  6. DNS 服务器 4013警告信息的解决
  7. Mathematica颜色系,你喜欢哪一个?
  8. dojo动态创建widget
  9. winform C#中Byte与String的转换方法,相互转换
  10. SSAS实践问题记录--OLAP 存储引擎中存在错误: 处理时找到重复的属性键