分享

把Android源码中的密码对转换为keystore的方法

 Ebric 2011-08-23

如果要在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 -out
shared.priv.pem -nocrypt

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

3.生成keystore:
$ keytool -importkeystore -deststorepass android -destkeypass android -destkeystore debug.keystore -srckeystore shared.pk12 -srcstoretype PKCS12 -srcstorepass android -alias androiddebugkey

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

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

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

 

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多