将android源码的签名包,转化为eclipse可以的签名包

来源:互联网 发布:mac上可以剪辑音频 编辑:程序博客网 时间:2024/04/30 09:10
 

如果要在Eclipse中调试Android源码中非test key签名的程序(也就是使用platform, media or shared key签名的程序),需要把Android源码中的公私钥对(build/target/product/security)转换为Eclipse能够使用的keystore。

 

转换步骤如下:
0. 把build/target/product/security下面的某对需要转换的key拷贝到一个你的工作目录
(下面以shared key为例:shared.pk8 & shared.x509.pem)


1. 把pkcs8格式的私钥转换为pkcs12格式:

$ openssl pkcs8 -in shared.pk8 -inform DER -outform PEM -outshared.priv.pem -nocrypt

这步生成shared.priv.pem


2.生成pkcs12格式的密钥文件:
$ openssl pkcs12 -export -in shared.x509.pem -inkeyshared.priv.pem -out shared.pk12 -name androiddebugkey
(注:此过程中需要输入密码:android)

这步生成shared.pk12


3.生成keystore:
$ keytool -importkeystore -deststorepass android -destkeypass android -destkeystoredebug.keystore

-srckeystore shared.pk12 -srcstoretype PKCS12 -srcstorepass android -alias androiddebugkey


至此,已经生成keystore:debug.keystore


在Eclipse的Windows/Preferences/Android/Build中设置“Custom debug keystore“为刚才生成的keystore即可。


对于其它类型的key,步骤相同。

原创粉丝点击