eclipse 如何从 key.pk8 和 certificate.pem 生成 Android 密钥库?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/22212869/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-19 21:33:28  来源:igfitidea点击:

How can I generate an Android Keystore from a key.pk8 and certificate.pem?

androideclipsekeystore

提问by Sam Shute

So today I finally update my SDK to 22.0.0 however this creates an error in the AndroidManifest.xml for android:debuggable="false"which means I can no longer externally sign and zipalign my own apks.

所以今天我终于将我的 SDK 更新到 22.0.0 但这会在 AndroidManifest.xml 中创建一个错误,android:debuggable="false"这意味着我不能再外部签名和压缩我自己的 apk。

I have been signing using my own key.pk8 and certificate.pem, however eclipse ADT requires a keystore.

我一直在使用我自己的 key.pk8 和 certificate.pem 进行签名,但是 eclipse ADT 需要一个密钥库。

Does anyone know a way to either build a keystore using my already generated key or find some way around this?

有没有人知道使用我已经生成的密钥构建密钥库或找到解决方法的方法?

回答by Sam Shute

Ok, So I eventually managed to solve the problem.

好的,所以我最终设法解决了这个问题。

I downloaded openssl for windows from here

我从这里下载了 windows 的 openssl

Keytool can be found at E:\Program Files\Java\jdk1.7.0_17\bin

可以在以下位置找到 Keytool E:\Program Files\Java\jdk1.7.0_17\bin

Then using keytool and openssl managed to build the key.pk8 and certificate.pem into a keystore entry

然后使用 keytool 和 openssl 设法将 key.pk8 和 certificate.pem 构建到一个密钥库条目中

openssl pkcs8 -inform DER -nocrypt -in key.pk8 -out key.pem

openssl pkcs12 -export -in certificate.pem -inkey key.pem -out platform.p12 -password pass:android -name mykey

keytool -importkeystore -deststorepass password -destkeystore .keystore -srckeystore platform.p12 -srcstoretype PKCS12 -srcstorepass android

keytool -list -v -keystore .keystore

The last step is just to verify that the key has been added to the keystore.

最后一步只是验证密钥是否已添加到密钥库中。