关键字
文章内容
把Android源码中的密码对转换为keystore的方法
 
 
修改时间:[2016/11/07 15:38]    阅读次数:[660]    发表者:[起缘]
 
如果要在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即可。