简体   繁体   English

适用于Android的Keytool公钥/私钥对

[英]Keytool Public/Private key pair for Android

I'm trying to create a public/private key pair using the keytool function so I can submit an Android app to Google Play. 我正在尝试使用keytool功能创建公钥/私钥对,以便我可以向Google Play提交Android应用。 When I try to sign the app using the key I made, I get this error from jarsigner 当我尝试使用我制作的密钥对应用程序进行签名时,我从jarsigner中收到此错误

jarsigner: Certificate chain not found for: SHA1withDSA.  
SHA1withDSA must reference a valid KeyStore 
key entry containing a private key and corresponding public key certificate chain.

Same thing when I try using RSA. 当我尝试使用RSA时也是如此。 When I look at the keys for the keystore, all I see if the 当我查看密钥库的密钥时,我只看到了
Entry type: PrivateKeyEntry 条目类型:PrivateKeyEntry

Not the public and private keys. 不是公钥和私钥。

The command I used to create they key was 我用来创建密钥的命令是

keytool -genkey -keystore nameofkeystore.keystore 
-alias coffitivity -keypass *passwordommitted* -storepass *thepasswordommitted*

I'm not actually 100% sure what I did to fix it, but this is what I did and now it works 我实际上并不是100%确定我做了什么来修复它,但这就是我所做的,现在它的工作原理

keytool -genkeypair -v -keystore my-release-key.keystore 
-alias coffdroid -keyalg RSA -keysize 2048 -validity 10000

Note: difference is I used "-genkeypair" instead of "genkey" even though they're supposed to be the same 注意:区别是我使用“-genkeypair”而不是“genkey”,即使它们应该是相同的

Second: made a new unsigned .apk. 第二:创建一个新的未签名.apk。 This is likely what fixed it - so if you're hitting the wall, do that over. 这很可能是修正它的原因 - 所以如果你正在撞墙,那就去做吧。

Then Jarsigner 然后是Jarsigner

jarsigner -verbose -sigalg SHA1withRSA -digestalg SHA1 
-keystore my-release-key.keystore /Users/tommynicholas/Desktop/*apkname*.apk coffdroid

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM